[commit: ghc] master: RdrHsSyn: Only suggest `type` qualification when appropriate (e996e85)

git at git.haskell.org git at git.haskell.org
Tue May 10 09:59:06 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e996e85f003e783fc8f9af0da653cdd0058d9646/ghc

>---------------------------------------------------------------

commit e996e85f003e783fc8f9af0da653cdd0058d9646
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Tue May 10 11:02:19 2016 +0200

    RdrHsSyn: Only suggest `type` qualification when appropriate
    
    This suggestion only applies to operators.


>---------------------------------------------------------------

e996e85f003e783fc8f9af0da653cdd0058d9646
 compiler/parser/RdrHsSyn.hs           | 7 ++++---
 testsuite/tests/module/T11432.stderr  | 4 ++--
 testsuite/tests/module/T11432a.stderr | 2 +-
 testsuite/tests/module/T12026.stderr  | 3 +--
 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 c3f1d53..c445bee 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 9e61092..61ccc7d 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 2542af3..79d6525 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 38d53d7..cd93875 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 afdc464..ef07a5a 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’.



More information about the ghc-commits mailing list