summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSoham Chowdhury <chow.soham@gmail.com>2017-05-11 15:40:18 -0400
committerBen Gamari <ben@smart-cactus.org>2017-05-11 17:26:18 -0400
commit1381c142cd8d030f9997cdc206dcad006c028bbb (patch)
tree2275933e04448f0fe06e6a2fa8a9c719537587b5 /testsuite
parent6f999230e8f955ee61c470d34a02650165643f68 (diff)
downloadhaskell-1381c142cd8d030f9997cdc206dcad006c028bbb.tar.gz
Fix incorrect ambiguity error on identically-named data constructors
Given multiple in-scope constructors with the same name, say `A`, and a function of type `A -> Int`, say, the compiler reports both a "type `A` is not in scope" and (incorrectly) an ambiguity error. The latter shouldn't be there if `DataKinds` isn't enabled. This issue was recommended to me by @mpickering as a suitable first task, and the fix was also outlined in the original Trac ticket. It involved a simple reordering of the steps taken in `lookup_demoted` in `RnEnv.hs`. The fix is to make the `DataKinds` check happen earlier, ensuring that the ambiguity check doesn't happen at all if we know the constructors couldn't have been promoted. Signed-off-by: Soham Chowdhury <chow.soham@gmail.com> Reviewers: mpickering, austin, bgamari Reviewed By: mpickering, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13568 Differential Revision: https://phabricator.haskell.org/D3547
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/module/mod122.stderr4
-rw-r--r--testsuite/tests/module/mod123.stderr4
-rw-r--r--testsuite/tests/module/mod124.stderr1
-rw-r--r--testsuite/tests/module/mod127.stderr1
-rw-r--r--testsuite/tests/module/mod29.stderr1
-rw-r--r--testsuite/tests/module/mod50.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/readFail001.stderr1
-rw-r--r--testsuite/tests/rename/prog003/rename.prog003.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/T13568.hs8
-rw-r--r--testsuite/tests/rename/should_fail/T13568.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/T13568a.hs3
-rw-r--r--testsuite/tests/rename/should_fail/T1595a.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/T5745.stderr4
-rw-r--r--testsuite/tests/rename/should_fail/all.T1
-rw-r--r--testsuite/tests/typecheck/should_fail/T1595.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail048.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail053.stderr4
17 files changed, 48 insertions, 10 deletions
diff --git a/testsuite/tests/module/mod122.stderr b/testsuite/tests/module/mod122.stderr
index 90719ecf06..66aaaf2304 100644
--- a/testsuite/tests/module/mod122.stderr
+++ b/testsuite/tests/module/mod122.stderr
@@ -1,2 +1,4 @@
-mod122.hs:5:6: Not in scope: type constructor or class ‘C’
+mod122.hs:5:6: error:
+ Not in scope: type constructor or class ‘C’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/module/mod123.stderr b/testsuite/tests/module/mod123.stderr
index 9d9de6bbb2..38390d05d1 100644
--- a/testsuite/tests/module/mod123.stderr
+++ b/testsuite/tests/module/mod123.stderr
@@ -1,2 +1,4 @@
-mod123.hs:5:6: Not in scope: type constructor or class ‘T’
+mod123.hs:5:6: error:
+ Not in scope: type constructor or class ‘T’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/module/mod124.stderr b/testsuite/tests/module/mod124.stderr
index a052a506ad..cbf9f4558e 100644
--- a/testsuite/tests/module/mod124.stderr
+++ b/testsuite/tests/module/mod124.stderr
@@ -1,5 +1,6 @@
mod124.hs:6:6: error:
Not in scope: type constructor or class ‘T’
+ A data constructor of that name is in scope; did you mean DataKinds?
Perhaps you want to remove ‘T’ from the explicit hiding list
in the import of ‘Mod124_A’ (mod124.hs:4:1-26).
diff --git a/testsuite/tests/module/mod127.stderr b/testsuite/tests/module/mod127.stderr
index 861d492d1a..462ebbccaf 100644
--- a/testsuite/tests/module/mod127.stderr
+++ b/testsuite/tests/module/mod127.stderr
@@ -1,5 +1,6 @@
mod127.hs:6:6: error:
Not in scope: type constructor or class ‘T’
+ A data constructor of that name is in scope; did you mean DataKinds?
Perhaps you want to remove ‘T’ from the explicit hiding list
in the import of ‘Mod127_A’ (mod127.hs:4:1-26).
diff --git a/testsuite/tests/module/mod29.stderr b/testsuite/tests/module/mod29.stderr
index e70c5df83d..08a019e13d 100644
--- a/testsuite/tests/module/mod29.stderr
+++ b/testsuite/tests/module/mod29.stderr
@@ -1,5 +1,6 @@
mod29.hs:6:12: error:
Not in scope: type constructor or class ‘Char’
+ A data constructor of that name is in scope; did you mean DataKinds?
Perhaps you want to add ‘Char’ to the import list in the import of
‘Prelude’ (mod29.hs:5:1-19).
diff --git a/testsuite/tests/module/mod50.stderr b/testsuite/tests/module/mod50.stderr
index 593148e3ab..94878a8faa 100644
--- a/testsuite/tests/module/mod50.stderr
+++ b/testsuite/tests/module/mod50.stderr
@@ -1,2 +1,4 @@
-mod50.hs:3:22: Not in scope: type constructor or class ‘Foo’
+mod50.hs:3:22: error:
+ Not in scope: type constructor or class ‘Foo’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/parser/should_fail/readFail001.stderr b/testsuite/tests/parser/should_fail/readFail001.stderr
index 6425d16c49..3284c1b51c 100644
--- a/testsuite/tests/parser/should_fail/readFail001.stderr
+++ b/testsuite/tests/parser/should_fail/readFail001.stderr
@@ -16,3 +16,4 @@ readFail001.hs:107:42: error: Not in scope: data constructor ‘Bar’
readFail001.hs:112:23: error:
Not in scope: type constructor or class ‘Foo’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/rename/prog003/rename.prog003.stderr b/testsuite/tests/rename/prog003/rename.prog003.stderr
index 7a0b5244c0..6babd0383b 100644
--- a/testsuite/tests/rename/prog003/rename.prog003.stderr
+++ b/testsuite/tests/rename/prog003/rename.prog003.stderr
@@ -1,2 +1,4 @@
-B.hs:4:6: Not in scope: type constructor or class ‘Class’
+B.hs:4:6: error:
+ Not in scope: type constructor or class ‘Class’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/rename/should_fail/T13568.hs b/testsuite/tests/rename/should_fail/T13568.hs
new file mode 100644
index 0000000000..f815c839ce
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T13568.hs
@@ -0,0 +1,8 @@
+module T13568 where
+
+import T13568a
+
+data S = A
+
+foo :: A -> ()
+foo = undefined
diff --git a/testsuite/tests/rename/should_fail/T13568.stderr b/testsuite/tests/rename/should_fail/T13568.stderr
new file mode 100644
index 0000000000..63ee18409a
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T13568.stderr
@@ -0,0 +1,4 @@
+
+T13568.hs:7:8: error:
+ Not in scope: type constructor or class ‘A’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/rename/should_fail/T13568a.hs b/testsuite/tests/rename/should_fail/T13568a.hs
new file mode 100644
index 0000000000..c25a48ad37
--- /dev/null
+++ b/testsuite/tests/rename/should_fail/T13568a.hs
@@ -0,0 +1,3 @@
+module T13568a where
+
+data T = A
diff --git a/testsuite/tests/rename/should_fail/T1595a.stderr b/testsuite/tests/rename/should_fail/T1595a.stderr
index 9705293a0a..9b19421f3a 100644
--- a/testsuite/tests/rename/should_fail/T1595a.stderr
+++ b/testsuite/tests/rename/should_fail/T1595a.stderr
@@ -1,2 +1,4 @@
-T1595a.hs:3:20: Not in scope: type constructor or class ‘Tpyo’
+T1595a.hs:3:20: error:
+ Not in scope: type constructor or class ‘Tpyo’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/rename/should_fail/T5745.stderr b/testsuite/tests/rename/should_fail/T5745.stderr
index 577ae069b3..94e3bd5217 100644
--- a/testsuite/tests/rename/should_fail/T5745.stderr
+++ b/testsuite/tests/rename/should_fail/T5745.stderr
@@ -1,2 +1,4 @@
-T5745.hs:5:6: Not in scope: type constructor or class ‘T’
+T5745.hs:5:6: error:
+ Not in scope: type constructor or class ‘T’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T
index 517d23dc9e..457f4010b1 100644
--- a/testsuite/tests/rename/should_fail/all.T
+++ b/testsuite/tests/rename/should_fail/all.T
@@ -126,3 +126,4 @@ test('T12686', normal, compile_fail, [''])
test('T11592', normal, compile_fail, [''])
test('T12879', normal, compile_fail, [''])
test('T13644', expect_broken(13644), multimod_compile_fail, ['T13644','-v0'])
+test('T13568', normal, multimod_compile_fail, ['T13568','-v0'])
diff --git a/testsuite/tests/typecheck/should_fail/T1595.stderr b/testsuite/tests/typecheck/should_fail/T1595.stderr
index 1f999c636b..bed30c42cf 100644
--- a/testsuite/tests/typecheck/should_fail/T1595.stderr
+++ b/testsuite/tests/typecheck/should_fail/T1595.stderr
@@ -1,6 +1,8 @@
-T1595.hs:8:15:
+T1595.hs:8:15: error:
Not in scope: type constructor or class ‘DoesNotExist’
+ A data constructor of that name is in scope; did you mean DataKinds?
-T1595.hs:13:22:
+T1595.hs:13:22: error:
Not in scope: type constructor or class ‘DoesNotExist’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/typecheck/should_fail/tcfail048.stderr b/testsuite/tests/typecheck/should_fail/tcfail048.stderr
index eaa2e52d36..4c1c300ef8 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail048.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail048.stderr
@@ -1,2 +1,4 @@
-tcfail048.hs:3:8: Not in scope: type constructor or class ‘B’
+tcfail048.hs:3:8: error:
+ Not in scope: type constructor or class ‘B’
+ A data constructor of that name is in scope; did you mean DataKinds?
diff --git a/testsuite/tests/typecheck/should_fail/tcfail053.stderr b/testsuite/tests/typecheck/should_fail/tcfail053.stderr
index a9b13bd6da..edd1537b14 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail053.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail053.stderr
@@ -1,2 +1,4 @@
-tcfail053.hs:3:12: Not in scope: type constructor or class ‘A’
+tcfail053.hs:3:12: error:
+ Not in scope: type constructor or class ‘A’
+ A data constructor of that name is in scope; did you mean DataKinds?