summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/rename/RnEnv.hs21
-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
18 files changed, 59 insertions, 20 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs
index 570c6c0b91..12c8557b96 100644
--- a/compiler/rename/RnEnv.hs
+++ b/compiler/rename/RnEnv.hs
@@ -706,16 +706,17 @@ lookup_demoted rdr_name dflags
| Just demoted_rdr <- demoteRdrName rdr_name
-- Maybe it's the name of a *data* constructor
= do { data_kinds <- xoptM LangExt.DataKinds
- ; mb_demoted_name <- lookupOccRn_maybe demoted_rdr
- ; case mb_demoted_name of
- Nothing -> unboundNameX WL_Any rdr_name star_info
- Just demoted_name
- | data_kinds ->
- do { whenWOptM Opt_WarnUntickedPromotedConstructors $
- addWarn (Reason Opt_WarnUntickedPromotedConstructors)
- (untickedPromConstrWarn demoted_name)
- ; return demoted_name }
- | otherwise -> unboundNameX WL_Any rdr_name suggest_dk }
+ ; if data_kinds
+ then do { mb_demoted_name <- lookupOccRn_maybe demoted_rdr
+ ; case mb_demoted_name of
+ Nothing -> unboundNameX WL_Any rdr_name star_info
+ Just demoted_name ->
+ do { whenWOptM Opt_WarnUntickedPromotedConstructors $
+ addWarn
+ (Reason Opt_WarnUntickedPromotedConstructors)
+ (untickedPromConstrWarn demoted_name)
+ ; return demoted_name } }
+ else unboundNameX WL_Any rdr_name suggest_dk }
| otherwise
= reportUnboundName rdr_name
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?