diff options
Diffstat (limited to 'testsuite/tests')
42 files changed, 138 insertions, 43 deletions
diff --git a/testsuite/tests/module/T11970B.hs b/testsuite/tests/module/T11970B.hs index 70a091f141..c3a502f5f2 100644 --- a/testsuite/tests/module/T11970B.hs +++ b/testsuite/tests/module/T11970B.hs @@ -1,5 +1,5 @@ module T11970B ( A(f) ) where -data A = A +data A = MkA -f = A +f = MkA diff --git a/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr b/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr index 7928c74258..866d1468cd 100644 --- a/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr +++ b/testsuite/tests/patsyn/should_fail/records-mixing-fields.stderr @@ -1,17 +1,14 @@ -records-mixing-fields.hs:1:1: error: - The IO action ‘main’ is not defined in module ‘Main’ - records-mixing-fields.hs:10:14: error: - Cannot use a mixture of pattern synonym and record selectors - Record selectors defined by ‘MyRec’: qux - Pattern synonym selectors defined by ‘HisRec’: f1 - In the expression: a {f1 = 1, qux = "two"} - In an equation for ‘updater1’: updater1 a = a {f1 = 1, qux = "two"} + • Cannot use a mixture of pattern synonym and record selectors + Record selectors defined by ‘MyRec’: qux + Pattern synonym selectors defined by ‘HisRec’: f1 + • In the expression: a {f1 = 1, qux = "two"} + In an equation for ‘updater1’: updater1 a = a {f1 = 1, qux = "two"} records-mixing-fields.hs:12:14: error: - Cannot use a mixture of pattern synonym and record selectors - Record selectors defined by ‘MyRec’: foo - Pattern synonym selectors defined by ‘HisRec’: f1 - In the expression: a {f1 = 1, foo = 2} - In an equation for ‘updater2’: updater2 a = a {f1 = 1, foo = 2} + • Cannot use a mixture of pattern synonym and record selectors + Record selectors defined by ‘MyRec’: foo + Pattern synonym selectors defined by ‘HisRec’: f1 + • In the expression: a {f1 = 1, foo = 2} + In an equation for ‘updater2’: updater2 a = a {f1 = 1, foo = 2} diff --git a/testsuite/tests/quantified-constraints/T17267e.stderr b/testsuite/tests/quantified-constraints/T17267e.stderr index b497fa1009..f94ba1e872 100644 --- a/testsuite/tests/quantified-constraints/T17267e.stderr +++ b/testsuite/tests/quantified-constraints/T17267e.stderr @@ -1,7 +1,4 @@ -T17267e.hs:1:1: error: - The IO action ‘main’ is not defined in module ‘Main’ - T17267e.hs:16:14: error: • Reduction stack overflow; size = 201 When simplifying the following type: Show a diff --git a/testsuite/tests/quotes/T18263.hs b/testsuite/tests/quotes/T18263.hs index 10e923480b..57f20fbf49 100644 --- a/testsuite/tests/quotes/T18263.hs +++ b/testsuite/tests/quotes/T18263.hs @@ -13,14 +13,21 @@ When looking up something with 'lookupGlobalOccRn_maybe', which is called by This should still fail to compile though, as reify should complain that "x" isn't in the type environment, albeit with one less error. + +Later (March 2021): actually this should really compile fine: + * The [d| ... |] splices in a top-level binding for x + * The reify looks for that binding +It was really a bug that it didn't work, now fixed. + -} module T18263 where import Language.Haskell.TH import Language.Haskell.TH.Syntax +import System.IO do n <- newName "x" - addModFinalizer $ reify n >>= runIO . print + addModFinalizer $ reify n >>= runIO . hPrint stderr [d| $(varP n) = 42 |] diff --git a/testsuite/tests/quotes/T18263.stderr b/testsuite/tests/quotes/T18263.stderr index 023432c85b..f8a7aab415 100644 --- a/testsuite/tests/quotes/T18263.stderr +++ b/testsuite/tests/quotes/T18263.stderr @@ -1,3 +1 @@ - -T18263.hs:1:1: - ‘x’ is not in the type environment at a reify +VarI T18263.x (ConT GHC.Num.Integer.Integer) Nothing diff --git a/testsuite/tests/quotes/all.T b/testsuite/tests/quotes/all.T index b0e5274761..68a13ca5ab 100644 --- a/testsuite/tests/quotes/all.T +++ b/testsuite/tests/quotes/all.T @@ -18,7 +18,7 @@ test('T10384', normal, compile_fail, ['']) test('T16384', req_th, compile, ['']) test('T17857', normal, compile, ['']) test('T18103', normal, compile, ['']) -test('T18263', normal, compile_fail, ['']) +test('T18263', normal, compile, ['']) test('T18521', normal, compile, ['']) test('TH_tf2', normal, compile, ['-v0']) diff --git a/testsuite/tests/th/TH_finalizer2M.hs b/testsuite/tests/th/TH_finalizer2M.hs index 7eea2d8f46..037c648d2a 100644 --- a/testsuite/tests/th/TH_finalizer2M.hs +++ b/testsuite/tests/th/TH_finalizer2M.hs @@ -1,5 +1,5 @@ {-# LANGUAGE TemplateHaskell #-} -module TH_finalizer2M where +module TH_finalizer2M( f, g) where import Language.Haskell.TH.Syntax diff --git a/testsuite/tests/typecheck/should_fail/T12906.stderr b/testsuite/tests/typecheck/should_fail/T12906.stderr index f1f245c912..0de9794533 100644 --- a/testsuite/tests/typecheck/should_fail/T12906.stderr +++ b/testsuite/tests/typecheck/should_fail/T12906.stderr @@ -1,7 +1,4 @@ -T12906.hs:1:1: error: - The IO action ‘main’ is not defined in module ‘Main’ - T12906.hs:2:7: error: • Couldn't match type: IO () with: [Char] diff --git a/testsuite/tests/typecheck/should_fail/T13292.hs b/testsuite/tests/typecheck/should_fail/T13292.hs index efc71b6539..c727812a2c 100644 --- a/testsuite/tests/typecheck/should_fail/T13292.hs +++ b/testsuite/tests/typecheck/should_fail/T13292.hs @@ -4,3 +4,8 @@ import T13292a -- main :: IO () main = someFunc + +-- This one is compiled with -fdefer-type-errors, and +-- annoyingly reports the ill-typed twice. It is awkward +-- to prevent this, and it's very much a corner case, +-- so I'm accepting it. See Note [Dealing with main] diff --git a/testsuite/tests/typecheck/should_fail/T13292.stderr b/testsuite/tests/typecheck/should_fail/T13292.stderr index 7607505d0e..a3a7ba3bae 100644 --- a/testsuite/tests/typecheck/should_fail/T13292.stderr +++ b/testsuite/tests/typecheck/should_fail/T13292.stderr @@ -19,5 +19,11 @@ T13292.hs:6:1: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘GHC.Types.Any’ with ‘IO’ Expected: IO () Actual: GHC.Types.Any () + • When checking the type of the IO action ‘main’ + +T13292.hs:6:1: warning: [-Wdeferred-type-errors (in -Wdefault)] + • Couldn't match type ‘GHC.Types.Any’ with ‘IO’ + Expected: IO () + Actual: GHC.Types.Any () • In the expression: main When checking the type of the IO action ‘main’ diff --git a/testsuite/tests/typecheck/should_fail/T16453E2.stderr b/testsuite/tests/typecheck/should_fail/T16453E2.stderr index 4999d60cc7..b7beedb511 100644 --- a/testsuite/tests/typecheck/should_fail/T16453E2.stderr +++ b/testsuite/tests/typecheck/should_fail/T16453E2.stderr @@ -1,9 +1,9 @@ -T16453E2.hs:1:1: - Ambiguous occurrence ‘main’ - It could refer to - either ‘T16453T.main’, - imported from ‘T16453T’ at T16453E2.hs:2:1-14 - (and originally defined at T16453T.hs:2:1-4) - or ‘T16453S.main’, - imported from ‘T16453S’ at T16453E2.hs:3:1-14 - (and originally defined at T16453S.hs:2:1-4) + +T16453E2.hs:1:28: error: + Conflicting exports for ‘main’: + ‘T16453T.main’ exports ‘T16453T.main’ + imported from ‘T16453T’ at T16453E2.hs:2:1-14 + (and originally defined at T16453T.hs:2:1-4) + ‘T16453S.main’ exports ‘T16453S.main’ + imported from ‘T16453S’ at T16453E2.hs:3:1-14 + (and originally defined at T16453S.hs:2:1-4) diff --git a/testsuite/tests/typecheck/should_fail/T19397E1.hs b/testsuite/tests/typecheck/should_fail/T19397E1.hs new file mode 100644 index 0000000000..e4b02ceb30 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E1.hs @@ -0,0 +1,5 @@ +module Main (main) where +import T19397S + +main :: IO () +main = putStrLn "T19397E1" diff --git a/testsuite/tests/typecheck/should_fail/T19397E1.stderr b/testsuite/tests/typecheck/should_fail/T19397E1.stderr new file mode 100644 index 0000000000..00c13f2eca --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E1.stderr @@ -0,0 +1,8 @@ + +T19397E1.hs:1:14: error: + Ambiguous occurrence ‘main’ + It could refer to + either ‘T19397S.main’, + imported from ‘T19397S’ at T19397E1.hs:2:1-14 + (and originally defined at T19397S.hs:4:1-4) + or ‘Main.main’, defined at T19397E1.hs:5:1 diff --git a/testsuite/tests/typecheck/should_fail/T19397E2.hs b/testsuite/tests/typecheck/should_fail/T19397E2.hs new file mode 100644 index 0000000000..3fb2b9dfca --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E2.hs @@ -0,0 +1,5 @@ + +import T19397S + +main :: IO () +main = putStrLn "T19397E2" diff --git a/testsuite/tests/typecheck/should_fail/T19397E2.stderr b/testsuite/tests/typecheck/should_fail/T19397E2.stderr new file mode 100644 index 0000000000..4fc5073310 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E2.stderr @@ -0,0 +1,8 @@ + +T19397E2.hs:1:1: error: + Ambiguous occurrence ‘main’ + It could refer to + either ‘T19397S.main’, + imported from ‘T19397S’ at T19397E2.hs:2:1-14 + (and originally defined at T19397S.hs:4:1-4) + or ‘Main.main’, defined at T19397E2.hs:5:1 diff --git a/testsuite/tests/typecheck/should_fail/T19397E3.hs b/testsuite/tests/typecheck/should_fail/T19397E3.hs new file mode 100644 index 0000000000..7836ea0f6a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E3.hs @@ -0,0 +1,2 @@ +module Main where +import T19397S (foo) diff --git a/testsuite/tests/typecheck/should_fail/T19397E3.stderr b/testsuite/tests/typecheck/should_fail/T19397E3.stderr new file mode 100644 index 0000000000..2359ec171a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E3.stderr @@ -0,0 +1,3 @@ + +T19397E3.hs:1:1: error: + The main IO action ‘foo’ is not defined in module ‘Main’ diff --git a/testsuite/tests/typecheck/should_fail/T19397E4.hs b/testsuite/tests/typecheck/should_fail/T19397E4.hs new file mode 100644 index 0000000000..1b4b9cf2b1 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E4.hs @@ -0,0 +1,5 @@ +module Main () where +import T19397S + +main :: IO () +main = putStrLn "T19397E4" diff --git a/testsuite/tests/typecheck/should_fail/T19397E4.stderr b/testsuite/tests/typecheck/should_fail/T19397E4.stderr new file mode 100644 index 0000000000..3f9eec7bf0 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397E4.stderr @@ -0,0 +1,3 @@ + +T19397E4.hs:1:1: error: + The main IO action ‘foo’ is not exported by module ‘Main’ diff --git a/testsuite/tests/typecheck/should_fail/T19397S.hs b/testsuite/tests/typecheck/should_fail/T19397S.hs new file mode 100644 index 0000000000..9316d7d99a --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T19397S.hs @@ -0,0 +1,7 @@ +module T19397S where + +main :: IO () +main = putStrLn "T19379S-main" + +foo :: IO () +foo = putStrLn "T19379S-foo" diff --git a/testsuite/tests/typecheck/should_fail/T2354.stderr b/testsuite/tests/typecheck/should_fail/T2354.stderr index 5c5fcfcf0e..e21eca081e 100644 --- a/testsuite/tests/typecheck/should_fail/T2354.stderr +++ b/testsuite/tests/typecheck/should_fail/T2354.stderr @@ -1,6 +1,6 @@ -T2354.hs:4:3: +T2354.hs:4:3: error: The NOINLINE pragma for default method ‘toInt’ lacks an accompanying binding -T2354.hs:6:3: +T2354.hs:6:3: error: The NOINLINE pragma for default method ‘fromInt’ lacks an accompanying binding diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 0bd86e9288..cdf26c15be 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -618,3 +618,11 @@ test('T18869', normal, compile_fail, ['']) test('T19142', normal, compile_fail, ['']) test('T19346', normal, compile_fail, ['-fprint-typechecker-elaboration']) test('T19364', normal, compile_fail, ['']) +test('T19397E1', extra_files(['T19397S.hs']), multimod_compile_fail, + ['T19397E1.hs', '-v0']) +test('T19397E2', extra_files(['T19397S.hs']), multimod_compile_fail, + ['T19397E2.hs', '-v0']) +test('T19397E3', extra_files(['T19397S.hs']), multimod_compile_fail, + ['T19397E3.hs', '-v0 -main-is foo']) +test('T19397E4', extra_files(['T19397S.hs']), multimod_compile_fail, + ['T19397E4.hs', '-v0 -main-is foo']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail199.stderr b/testsuite/tests/typecheck/should_fail/tcfail199.stderr index 50fc8e5f44..5ef1ebab33 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail199.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail199.stderr @@ -4,5 +4,4 @@ tcfail199.hs:5:1: error: with: IO t0 Expected: IO t0 Actual: String - • In the expression: main - When checking the type of the IO action ‘main’ + • When checking the type of the IO action ‘main’ diff --git a/testsuite/tests/typecheck/should_run/T16453M1.stdout b/testsuite/tests/typecheck/should_run/T16453M1.stdout index e4dfbcd44f..3c86130b45 100644 --- a/testsuite/tests/typecheck/should_run/T16453M1.stdout +++ b/testsuite/tests/typecheck/should_run/T16453M1.stdout @@ -1 +1 @@ -T16453T +T16453T.main diff --git a/testsuite/tests/typecheck/should_run/T16453M4.stdout b/testsuite/tests/typecheck/should_run/T16453M4.stdout index e4dfbcd44f..3c86130b45 100644 --- a/testsuite/tests/typecheck/should_run/T16453M4.stdout +++ b/testsuite/tests/typecheck/should_run/T16453M4.stdout @@ -1 +1 @@ -T16453T +T16453T.main diff --git a/testsuite/tests/typecheck/should_run/T16453M5.hs b/testsuite/tests/typecheck/should_run/T16453M5.hs new file mode 100644 index 0000000000..a79a33003d --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T16453M5.hs @@ -0,0 +1,2 @@ +module Main (T16453T.main) where +import T16453T diff --git a/testsuite/tests/typecheck/should_run/T16453M5.stdout b/testsuite/tests/typecheck/should_run/T16453M5.stdout new file mode 100644 index 0000000000..3c86130b45 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T16453M5.stdout @@ -0,0 +1 @@ +T16453T.main diff --git a/testsuite/tests/typecheck/should_run/T16453M6.hs b/testsuite/tests/typecheck/should_run/T16453M6.hs new file mode 100644 index 0000000000..b013e857cd --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T16453M6.hs @@ -0,0 +1,2 @@ +module Main (T16453T.foo) where +import T16453T diff --git a/testsuite/tests/typecheck/should_run/T16453M6.stdout b/testsuite/tests/typecheck/should_run/T16453M6.stdout new file mode 100644 index 0000000000..72252ffbd0 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T16453M6.stdout @@ -0,0 +1 @@ +T16453T.foo diff --git a/testsuite/tests/typecheck/should_run/T16453T.hs b/testsuite/tests/typecheck/should_run/T16453T.hs index 98ea6255f7..b8dd8923c4 100644 --- a/testsuite/tests/typecheck/should_run/T16453T.hs +++ b/testsuite/tests/typecheck/should_run/T16453T.hs @@ -1,2 +1,4 @@ module T16453T where -main = putStrLn "T16453T" +main = putStrLn "T16453T.main" +foo = putStrLn "T16453T.foo" + diff --git a/testsuite/tests/typecheck/should_run/T19397M0.hs b/testsuite/tests/typecheck/should_run/T19397M0.hs new file mode 100644 index 0000000000..fcc08716d5 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M0.hs @@ -0,0 +1,2 @@ +module Main (main) where +import T19397S diff --git a/testsuite/tests/typecheck/should_run/T19397M0.stdout b/testsuite/tests/typecheck/should_run/T19397M0.stdout new file mode 100644 index 0000000000..4ff016fc0e --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M0.stdout @@ -0,0 +1 @@ +T19379S-main diff --git a/testsuite/tests/typecheck/should_run/T19397M1.hs b/testsuite/tests/typecheck/should_run/T19397M1.hs new file mode 100644 index 0000000000..75413537c8 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M1.hs @@ -0,0 +1 @@ +import T19397S diff --git a/testsuite/tests/typecheck/should_run/T19397M1.stdout b/testsuite/tests/typecheck/should_run/T19397M1.stdout new file mode 100644 index 0000000000..4ff016fc0e --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M1.stdout @@ -0,0 +1 @@ +T19379S-main diff --git a/testsuite/tests/typecheck/should_run/T19397M2.hs b/testsuite/tests/typecheck/should_run/T19397M2.hs new file mode 100644 index 0000000000..71a75a102b --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M2.hs @@ -0,0 +1,2 @@ +module Main(foo) where +import T19397S (foo) diff --git a/testsuite/tests/typecheck/should_run/T19397M2.stdout b/testsuite/tests/typecheck/should_run/T19397M2.stdout new file mode 100644 index 0000000000..3fe3b9aac6 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M2.stdout @@ -0,0 +1 @@ +T19379S-foo diff --git a/testsuite/tests/typecheck/should_run/T19397M3.hs b/testsuite/tests/typecheck/should_run/T19397M3.hs new file mode 100644 index 0000000000..fd817a8176 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M3.hs @@ -0,0 +1 @@ +import T19397S (foo) diff --git a/testsuite/tests/typecheck/should_run/T19397M3.stdout b/testsuite/tests/typecheck/should_run/T19397M3.stdout new file mode 100644 index 0000000000..3fe3b9aac6 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M3.stdout @@ -0,0 +1 @@ +T19379S-foo diff --git a/testsuite/tests/typecheck/should_run/T19397M4.hs b/testsuite/tests/typecheck/should_run/T19397M4.hs new file mode 100644 index 0000000000..544242c2f5 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M4.hs @@ -0,0 +1,2 @@ +module Main(module T19397S) where +import T19397S (foo) diff --git a/testsuite/tests/typecheck/should_run/T19397M4.stdout b/testsuite/tests/typecheck/should_run/T19397M4.stdout new file mode 100644 index 0000000000..3fe3b9aac6 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397M4.stdout @@ -0,0 +1 @@ +T19379S-foo diff --git a/testsuite/tests/typecheck/should_run/T19397S.hs b/testsuite/tests/typecheck/should_run/T19397S.hs new file mode 100644 index 0000000000..9316d7d99a --- /dev/null +++ b/testsuite/tests/typecheck/should_run/T19397S.hs @@ -0,0 +1,7 @@ +module T19397S where + +main :: IO () +main = putStrLn "T19379S-main" + +foo :: IO () +foo = putStrLn "T19379S-foo" diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index ef7bedb354..c4005e402e 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -140,6 +140,8 @@ test('T16453M1', extra_files(['T16453T.hs']), compile_and_run, ['']) test('T16453M2', extra_files(['T16453T.hs']), compile_and_run, ['']) test('T16453M3', extra_files(['T16453T.hs']), compile_and_run, ['']) test('T16453M4', extra_files(['T16453T.hs']), compile_and_run, ['']) +test('T16453M5', extra_files(['T16453T.hs']), compile_and_run, ['']) +test('T16453M6', extra_files(['T16453T.hs']), compile_and_run, ['-main-is foo']) test('UnliftedNewtypesRun', normal, compile_and_run, ['']) test('UnliftedNewtypesFamilyRun', normal, compile_and_run, ['']) test('UnliftedNewtypesDependentFamilyRun', normal, compile_and_run, ['']) @@ -148,3 +150,8 @@ test('UnliftedNewtypesCoerceRun', normal, compile_and_run, ['']) test('LevPolyResultInst', normal, compile_and_run, ['']) test('T17104', normal, compile_and_run, ['']) test('T18627', normal, compile_and_run, ['-O']) # Optimisation shows up the bug +test('T19397M0', extra_files(['T19397S.hs']), compile_and_run, ['']) +test('T19397M1', extra_files(['T19397S.hs']), compile_and_run, ['']) +test('T19397M2', extra_files(['T19397S.hs']), compile_and_run, ['-main-is foo']) +test('T19397M3', extra_files(['T19397S.hs']), compile_and_run, ['-main-is foo']) +test('T19397M4', extra_files(['T19397S.hs']), compile_and_run, ['-main-is foo']) |