Fix get_op in the case of an unambiguous record selector (#13132)
authorReid Barton <rwbarton@gmail.com>
Wed, 18 Jan 2017 21:24:28 +0000 (16:24 -0500)
committerBen Gamari <ben@smart-cactus.org>
Wed, 18 Jan 2017 22:39:48 +0000 (17:39 -0500)
Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2985

GHC Trac Issues: #13132

compiler/rename/RnTypes.hs
testsuite/tests/rename/should_compile/T13132.hs [new file with mode: 0644]
testsuite/tests/rename/should_compile/all.T

index 6cd6ea8..421fba5 100644 (file)
@@ -1227,6 +1227,7 @@ get_op :: LHsExpr Name -> Name
 -- See RnExpr.rnUnboundVar
 get_op (L _ (HsVar (L _ n)))   = n
 get_op (L _ (HsUnboundVar uv)) = mkUnboundName (unboundVarOcc uv)
+get_op (L _ (HsRecFld (Unambiguous _ n))) = n
 get_op other                   = pprPanic "get_op" (ppr other)
 
 -- Parser left-associates everything, but
diff --git a/testsuite/tests/rename/should_compile/T13132.hs b/testsuite/tests/rename/should_compile/T13132.hs
new file mode 100644 (file)
index 0000000..7070607
--- /dev/null
@@ -0,0 +1,5 @@
+module Bug where
+
+newtype ContT r m a = ContT { runContT :: (a -> m r) -> m r }
+
+foo bar baz = (`runContT` bar.baz)
index 90d955b..2963905 100644 (file)
@@ -245,3 +245,4 @@ test('T12127',
 test('T12533', normal, compile, [''])
 test('T12597', normal, compile, [''])
 test('T12548', normal, compile, [''])
+test('T13132', normal, compile, [''])