[commit: ghc] ghc-8.0: RdrHsSyn: Only suggest `type` qualification when appropriate (d7cd313)

git at git.haskell.org git at git.haskell.org
Tue May 10 13:05:24 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/d7cd313171c2669ddfdcf72faace23bacf79d320/ghc

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

commit d7cd313171c2669ddfdcf72faace23bacf79d320
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.


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

d7cd313171c2669ddfdcf72faace23bacf79d320
 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 35b82a2..3ed972e 100644
--- a/compiler/parser/RdrHsSyn.hs
+++ b/compiler/parser/RdrHsSyn.hs
@@ -1410,11 +1410,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