diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index dbc5a902ab7ccc0dc8918557e7c51656a6843efd..8791625e06df66710bd70a6d9c487f4de737ef9c 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -723,16 +723,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 90719ecf0661d36602de30eaac18ed41bd8305fb..66aaaf23041e11cf43e6e93031a309c263b0b0f4 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 9d9de6bbb26e8a299648ea20ba6d31602d2de7eb..38390d05d1f544ce02222f881c75bd9c413ae0d3 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 a052a506ad2b37a92012d6f2d43a834e7260b74a..cbf9f4558e553843ebefb3c1b034cb9867283ca6 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 861d492d1a3510801b65e331f43438fc54b79fcd..462ebbccaf7116fcd888b80e9016a6906a28e2e9 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 e70c5df83d4974569bfdb8b176e39db7ae3512e2..08a019e13d061ec3e5ef744b3aa1d05e39b75546 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 593148e3ab06514efdee0bb64e3d3134ae11eb90..94878a8faa9a429c31f341f3f49e3d527079c122 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 6425d16c49d99d99d8c341fb7cc2336a2d003851..3284c1b51c4514ca0af0653e5a881e90faca747f 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 7a0b5244c0c366dcd9907549dbb9b82d2df61629..6babd0383bd9e2143b7c64110869acfa3d46a34a 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 0000000000000000000000000000000000000000..f815c839ce1c52607461c012a79d5239d048922f --- /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 0000000000000000000000000000000000000000..63ee18409ac2bca444c4ff687790fe3b36ad51e6 --- /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 0000000000000000000000000000000000000000..c25a48ad379934adc1621e4e8b0e408193500187 --- /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 9705293a0a7a2be748b9a549ce539db882b13b92..9b19421f3a45e411168cd1c362b116079d31a900 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 577ae069b3bef3c69623ab834e455dfd40bef6ea..94e3bd521718aac2a130c9e3060c705ca052d5a5 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 4782685f5e2651f3b7bfd06d22d74f5947acd2cc..9acd5b83ddef6429ca9e585c5616f6250780d54e 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -125,3 +125,4 @@ test('T12681', normal, multimod_compile_fail, ['T12681','-v0']) test('T12686', normal, compile_fail, ['']) test('T11592', normal, compile_fail, ['']) test('T12879', normal, compile_fail, ['']) +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 1f999c636b0a17239f1b7081c0b249e8bc62bfd9..bed30c42cf993a2f1484c974016165beb2352e44 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 eaa2e52d36ef3d2a5ffb1536c2aa8c5b51b838fb..4c1c300ef8f5a6655bea4001399ff2bc3b8ebe4b 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 a9b13bd6dae2819f79f4b8726eb5da39f580910e..edd1537b1424453f731e3c0e5c6ef2949484fe65 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?