summaryrefslogtreecommitdiff
path: root/testsuite/tests/module
diff options
context:
space:
mode:
authorDaniel Rogozin <daniel.rogozin@serokell.io>2020-09-24 16:30:59 +0300
committerDaniel Rogozin <daniel.rogozin@serokell.io>2020-10-11 22:20:04 +0300
commit990ea991a1c35fdb894fcb91f919fb8f8fed33dd (patch)
tree6a2a2c9719e692927bcfa2cac4f832c4f12c0753 /testsuite/tests/module
parent274e21f02fabb4b3761841972b1074d0c0146fae (diff)
downloadhaskell-990ea991a1c35fdb894fcb91f919fb8f8fed33dd.tar.gz
Fall back to types when looking up data constructors (#18740)wip/ghc-18740-lookup-update
Before this patch, referring to a data constructor in a term-level context led to a scoping error: ghci> id Int <interactive>:1:4: error: Data constructor not in scope: Int After this patch, the renamer falls back to the type namespace and successfully finds the Int. It is then rejected in the type checker with a more useful error message: <interactive>:1:4: error: • Illegal term-level use of the type constructor ‘Int’ imported from ‘Prelude’ (and originally defined in ‘GHC.Types’) • In the first argument of ‘id’, namely ‘Int’ In the expression: id Int We also do this for type variables.
Diffstat (limited to 'testsuite/tests/module')
-rw-r--r--testsuite/tests/module/mod132.stderr7
-rw-r--r--testsuite/tests/module/mod147.stderr7
2 files changed, 11 insertions, 3 deletions
diff --git a/testsuite/tests/module/mod132.stderr b/testsuite/tests/module/mod132.stderr
index 647a405bf9..37c934c70f 100644
--- a/testsuite/tests/module/mod132.stderr
+++ b/testsuite/tests/module/mod132.stderr
@@ -1,4 +1,7 @@
mod132.hs:6:7: error:
- • Data constructor not in scope: Foo
- • Perhaps you meant variable ‘foo’ (line 6)
+ Illegal term-level use of the type constructor ‘Foo’
+ imported from ‘Mod132_B’ at mod132.hs:4:1-15
+ (and originally defined in ‘Mod132_A’ at Mod132_A.hs:3:1-14)
+ In the expression: Foo
+ In an equation for ‘foo’: foo = Foo
diff --git a/testsuite/tests/module/mod147.stderr b/testsuite/tests/module/mod147.stderr
index 0a4e3fd662..80267f8f24 100644
--- a/testsuite/tests/module/mod147.stderr
+++ b/testsuite/tests/module/mod147.stderr
@@ -1,2 +1,7 @@
-mod147.hs:6:5: error: Data constructor not in scope: D :: t0 -> t
+mod147.hs:6:5:
+ Illegal term-level use of the type constructor ‘D’
+ imported from ‘Mod147_A’ at mod147.hs:4:1-15
+ (and originally defined at Mod147_A.hs:3:1-14)
+ In the expression: D 4
+ In an equation for ‘x’: x = D 4