diff options
author | Ben Gamari <ben@smart-cactus.org> | 2016-05-10 11:02:19 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-05-10 12:02:14 +0200 |
commit | e996e85f003e783fc8f9af0da653cdd0058d9646 (patch) | |
tree | add1d4dd9f18ea6662c484a2c4116b99d0a53e2c | |
parent | 53f26f5a45f146e1cc988bbcf76a362c877beaa2 (diff) | |
download | haskell-e996e85f003e783fc8f9af0da653cdd0058d9646.tar.gz |
RdrHsSyn: Only suggest `type` qualification when appropriate
This suggestion only applies to operators.
-rw-r--r-- | compiler/parser/RdrHsSyn.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/module/T11432.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/module/T11432a.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/module/T12026.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/module/mod89.stderr | 3 |
5 files changed, 9 insertions, 10 deletions
diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index c3f1d53d65..c445bee793 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -1406,11 +1406,12 @@ mkModuleImpExp n@(L l name) subs = nameT = if isVarNameSpace (rdrNameSpace name) then parseErrorSDoc l - (text "Expecting a type constructor but found a variable." + (text "Expecting a type constructor but found a variable," + <+> quotes (ppr name) <> text "." $$ if isSymOcc $ rdrNameOcc name then text "If" <+> quotes (ppr name) <+> text "is a type constructor" - else empty - <+> text "then enable ExplicitNamespaces and use the 'type' keyword.") + <+> text "then enable ExplicitNamespaces and use the 'type' keyword." + else empty) else return $ name mkTypeImpExp :: Located RdrName -- TcCls or Var name space diff --git a/testsuite/tests/module/T11432.stderr b/testsuite/tests/module/T11432.stderr index 9e61092e37..61ccc7d960 100644 --- a/testsuite/tests/module/T11432.stderr +++ b/testsuite/tests/module/T11432.stderr @@ -1,4 +1,4 @@ T11432.hs:7:16: error: - Expecting a type constructor but found a variable. - If ‘-.->’ is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ‘-.->’. + If ‘-.->’ is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. diff --git a/testsuite/tests/module/T11432a.stderr b/testsuite/tests/module/T11432a.stderr index 2542af3fe0..79d65257e6 100644 --- a/testsuite/tests/module/T11432a.stderr +++ b/testsuite/tests/module/T11432a.stderr @@ -1,4 +1,4 @@ T11432a.hs:7:17: error: - Expecting a type constructor but found a variable. + Expecting a type constructor but found a variable, ‘-.->’. If ‘-.->’ is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. diff --git a/testsuite/tests/module/T12026.stderr b/testsuite/tests/module/T12026.stderr index 38d53d7049..cd93875dc2 100644 --- a/testsuite/tests/module/T12026.stderr +++ b/testsuite/tests/module/T12026.stderr @@ -1,4 +1,3 @@ T12026.hs:3:17: error: - Expecting a type constructor but found a variable. - If ‘map’ is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ‘map’. diff --git a/testsuite/tests/module/mod89.stderr b/testsuite/tests/module/mod89.stderr index afdc46466f..ef07a5ab8a 100644 --- a/testsuite/tests/module/mod89.stderr +++ b/testsuite/tests/module/mod89.stderr @@ -1,4 +1,3 @@ mod89.hs:5:16: error: - Expecting a type constructor but found a variable. - If ‘map’ is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ‘map’. |