diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-07-08 23:42:28 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-07-08 23:42:28 +0100 |
commit | 4f9d6008c04b71fc9449b3dc10861f757539ed0f (patch) | |
tree | c9698c18a01694e6fa4afa32d96727792ba55715 | |
parent | 85b14a777917edd2d6b7d4b3584496cab28bada6 (diff) | |
download | haskell-4f9d6008c04b71fc9449b3dc10861f757539ed0f.tar.gz |
Fix Trac #10618 (out of scope operator)
Out of scope variables now generate HsUnboundVar,
and the fixity re-jigging wasn't taking this into
account.
-rw-r--r-- | compiler/rename/RnTypes.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T10618.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T10618.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 1 |
4 files changed, 15 insertions, 2 deletions
diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs index 705ca557d4..ac2982ba4f 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/rename/RnTypes.hs @@ -829,8 +829,11 @@ mkOpAppRn e1 op fix e2 -- Default case, no rearrangment ---------------------------- get_op :: LHsExpr Name -> Name -get_op (L _ (HsVar n)) = n -get_op other = pprPanic "get_op" (ppr other) +-- An unbound name could be either HsVar or HsUnboundVra +-- See RnExpr.rnUnboundVar +get_op (L _ (HsVar n)) = n +get_op (L _ (HsUnboundVar occ)) = mkUnboundName (mkRdrUnqual occ) +get_op other = pprPanic "get_op" (ppr other) -- Parser left-associates everything, but -- derived instances may have correctly-associated things to diff --git a/testsuite/tests/rename/should_fail/T10618.hs b/testsuite/tests/rename/should_fail/T10618.hs new file mode 100644 index 0000000000..28b665f6fb --- /dev/null +++ b/testsuite/tests/rename/should_fail/T10618.hs @@ -0,0 +1,3 @@ +module T10618 where + +foo = Just $ Nothing <> Nothing diff --git a/testsuite/tests/rename/should_fail/T10618.stderr b/testsuite/tests/rename/should_fail/T10618.stderr new file mode 100644 index 0000000000..01e194877f --- /dev/null +++ b/testsuite/tests/rename/should_fail/T10618.stderr @@ -0,0 +1,6 @@ +
+T10618.hs:3:22: error:
+ Variable not in scope: (<>) :: Maybe (Maybe a0) -> Maybe a1 -> t
+ Perhaps you meant one of these:
+ ‘<$>’ (imported from Prelude), ‘*>’ (imported from Prelude),
+ ‘<$’ (imported from Prelude)
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index 0df986889d..bfd81c51f9 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -133,3 +133,4 @@ test('T9032', normal, run_command, ['$MAKE -s --no-print-directory T9032']) +test('T10618', normal, compile_fail, ['']) |