summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2021-06-11 23:14:56 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-25 15:41:24 -0400
commit0bb78838e213467b9b5bd2b38767b39b46a294c5 (patch)
treed491064a69b3d0dd5f65fcee12bc340a36a34dd0 /testsuite
parent83dce402043532d43635b305eca76a6f1cf4deff (diff)
downloadhaskell-0bb78838e213467b9b5bd2b38767b39b46a294c5.tar.gz
Suggest similar names when reporting types in terms (#19978)
This fixes an error message regression.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/module/mod132.stderr5
-rw-r--r--testsuite/tests/typecheck/should_fail/T19978.hs25
-rw-r--r--testsuite/tests/typecheck/should_fail/T19978.stderr21
-rw-r--r--testsuite/tests/typecheck/should_fail/all.T1
4 files changed, 50 insertions, 2 deletions
diff --git a/testsuite/tests/module/mod132.stderr b/testsuite/tests/module/mod132.stderr
index 37c934c70f..31d9c8eeb6 100644
--- a/testsuite/tests/module/mod132.stderr
+++ b/testsuite/tests/module/mod132.stderr
@@ -1,7 +1,8 @@
mod132.hs:6:7: error:
- Illegal term-level use of the type constructor ‘Foo’
+ • 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
+ Perhaps you meant variable ‘foo’ (line 6)
+ • In the expression: Foo
In an equation for ‘foo’: foo = Foo
diff --git a/testsuite/tests/typecheck/should_fail/T19978.hs b/testsuite/tests/typecheck/should_fail/T19978.hs
new file mode 100644
index 0000000000..fd96697db9
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T19978.hs
@@ -0,0 +1,25 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+
+module T19978 where
+
+-----------------------------------------
+-- Type constructor in terms --
+-----------------------------------------
+ex1 = Bool
+
+-- to be suggested instead of "Bool" in "ex1":
+data T1 = Bowl
+bool = Bowl
+
+ex2 = Let -- should suggest Left (imported from Prelude)
+
+-----------------------------------------
+-- Type variable in terms --
+-----------------------------------------
+
+ex3 :: forall mytv. mytv
+ex3 = mytv
+
+-- to be suggested instead of "mytv" in "ex3":
+data T3 = Mytv
+myvv = Mytv
diff --git a/testsuite/tests/typecheck/should_fail/T19978.stderr b/testsuite/tests/typecheck/should_fail/T19978.stderr
new file mode 100644
index 0000000000..7f41c37ad4
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T19978.stderr
@@ -0,0 +1,21 @@
+
+T19978.hs:8:7: error:
+ • Illegal term-level use of the type constructor ‘Bool’
+ imported from ‘Prelude’ at T19978.hs:3:8-13
+ (and originally defined in ‘GHC.Types’)
+ Perhaps you meant one of these:
+ ‘Bowl’ (line 11), variable ‘bool’ (line 12)
+ • In the expression: Bool
+ In an equation for ‘ex1’: ex1 = Bool
+
+T19978.hs:14:7: error:
+ • Data constructor not in scope: Let
+ • Perhaps you meant ‘Left’ (imported from Prelude)
+
+T19978.hs:21:7: error:
+ • Illegal term-level use of the type variable ‘mytv’
+ bound at T19978.hs:20:15
+ Perhaps you meant one of these:
+ data constructor ‘Mytv’ (line 24), ‘myvv’ (line 25)
+ • In the expression: mytv
+ In an equation for ‘ex3’: ex3 = mytv
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 54af02c6f5..b776f1d5dd 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -631,3 +631,4 @@ test('T19415', normal, compile_fail, [''])
test('T19615', normal, compile_fail, [''])
test('T17817', normal, compile_fail, [''])
test('T17817_elab', normal, compile_fail, ['-fprint-typechecker-elaboration'])
+test('T19978', normal, compile_fail, [''])