summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck
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/tests/typecheck
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/tests/typecheck')
-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
3 files changed, 10 insertions, 4 deletions
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?