Simon Jakobi pushed to branch wip/sjakobi/regression-tests-3 at Glasgow Haskell Compiler / GHC Commits: 815bb2b8 by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression test for #12002 Closes #12002. - - - - - 0afc6290 by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression test for #12046 Closes #12046. - - - - - 2b8649fc by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression test for #13180 Closes #13180. - - - - - 0d5be8c7 by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression test for #11141 Closes #11141. - - - - - 06766598 by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression test for #11505 Closes #11505. - - - - - e66d54a3 by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression perf test for #13820 Closes #13820. - - - - - b811b708 by Simon Jakobi at 2026-03-09T13:29:58+01:00 Add regression test for #10381 Closes #10381. - - - - - 19 changed files: - + testsuite/tests/parser/should_compile/T12002.hs - + testsuite/tests/parser/should_compile/T12002.stderr - testsuite/tests/parser/should_compile/all.T - + testsuite/tests/perf/compiler/T13820.hs - testsuite/tests/perf/compiler/all.T - + testsuite/tests/rebindable/T10381.hs - testsuite/tests/rebindable/all.T - + testsuite/tests/typecheck/T13180/T13180.hs - + testsuite/tests/typecheck/T13180/T13180.hs-boot - + testsuite/tests/typecheck/T13180/T13180.stderr - + testsuite/tests/typecheck/T13180/T13180A.hs - + testsuite/tests/typecheck/T13180/all.T - + testsuite/tests/typecheck/should_compile/T11141.hs - + testsuite/tests/typecheck/should_compile/T11141.stderr - + testsuite/tests/typecheck/should_compile/T11505Bar.hs - + testsuite/tests/typecheck/should_compile/T11505Foo.hs - + testsuite/tests/typecheck/should_compile/T11505Foo.hs-boot - + testsuite/tests/typecheck/should_compile/T12046.hs - testsuite/tests/typecheck/should_compile/all.T Changes: ===================================== testsuite/tests/parser/should_compile/T12002.hs ===================================== @@ -0,0 +1,5 @@ +-- Test that the misplaced LANGUAGE pragma results in a warning but doesn't +-- cause the program to be rejected. +module T12002 where + +{-# LANGUAGE OverloadedStrings #-} ===================================== testsuite/tests/parser/should_compile/T12002.stderr ===================================== @@ -0,0 +1,6 @@ +T12002.hs:5:1: warning: [GHC-28007] [-Wmisplaced-pragmas (in -Wdefault)] + Misplaced LANGUAGE pragma + Suggested fix: + Perhaps you meant to place it in the module header? + The module header is the section at the top of the file, before the ‘module’ keyword + ===================================== testsuite/tests/parser/should_compile/all.T ===================================== @@ -116,6 +116,7 @@ test('DumpParsedAst', normal, compile, ['-dsuppress-uniques -ddump-parsed-a test('DumpParsedAstComments', normal, compile, ['-dsuppress-uniques -ddump-parsed-ast -dkeep-comments']) test('DumpRenamedAst', normal, compile, ['-dsuppress-uniques -ddump-rn-ast']) test('DumpTypecheckedAst', normal, compile, ['-dsuppress-uniques -ddump-tc-ast']) +test('T12002', normal, compile, ['']) test('T12045e', normal, compile, ['']) test('T13087', normal, compile, ['']) test('T13747', normal, compile, ['']) ===================================== testsuite/tests/perf/compiler/T13820.hs ===================================== @@ -0,0 +1,11 @@ +-- Regression test for #13820. Instead of the original 27 `id`s, this +-- test uses only 24, so a regression is less likely to result in an +-- out-of-memory situation. +f = id id id id + id id id id + id id id id + id id id id + id id id id + id id id id + +main = print 1 ===================================== testsuite/tests/perf/compiler/all.T ===================================== @@ -680,6 +680,12 @@ test ('T13253-spj', ], compile, ['-v0 -O']) +test ('T13820', + [ collect_compiler_stats('peak_megabytes_allocated', 5), + collect_compiler_stats('bytes allocated', 2), + ], + compile, + ['-v0']) test ('T14766', [ collect_compiler_stats('bytes allocated',2), pre_cmd('python3 genT14766.py > T14766.hs'), ===================================== testsuite/tests/rebindable/T10381.hs ===================================== @@ -0,0 +1,43 @@ +{-# LANGUAGE RebindableSyntax, RankNTypes #-} + +module T10381 where + +import Prelude ( String, undefined ) + +newtype Cont r a = Cont { runCont :: (forall i. a i -> r) -> r } + +(>>=) :: Cont r a -> (forall i. a i -> Cont r b) -> Cont r b +ma >>= fmb + = Cont (\k -> runCont ma (\a -> runCont (fmb a) k)) + +fail :: String -> Cont r a +fail = undefined + +return :: a i -> Cont r a +return x = Cont (\k -> k x) + +foo :: Cont r [] +foo = do + bar <- foo + return bar + +{- Previously, GHC used to reject this program with: + + Couldn't match type ‘i0’ with ‘i’ + because type variable ‘i’ would escape its scope + This (rigid, skolem) type variable is bound by + a type expected by the context: [i] -> Cont r [] + at Bug.hs:21:3-12 + Expected type: Cont r [] -> ([i0] -> Cont r []) -> Cont r [] + Actual type: Cont r [] + -> (forall i. [i] -> Cont r []) -> Cont r [] + In a stmt of a 'do' block: bar <- foo + In the expression: + do { bar <- foo; + return bar } + In an equation for ‘foo’: + foo + = do { bar <- foo; + return bar } +-} + ===================================== testsuite/tests/rebindable/all.T ===================================== @@ -35,6 +35,7 @@ test('T4851', normal, compile, ['']) test('T5908', normal, compile, ['']) test('T10112', normal, compile, ['']) +test('T10381', normal, compile, ['']) test('T11216', normal, compile, ['']) test('T11216A', normal, compile, ['']) test('T12080', normal, compile, ['']) ===================================== testsuite/tests/typecheck/T13180/T13180.hs ===================================== @@ -0,0 +1,8 @@ +module T13180 (T, f) where + +import qualified T13180A + +type T = Int + +f :: T -> T +f x = T13180A.f x ===================================== testsuite/tests/typecheck/T13180/T13180.hs-boot ===================================== @@ -0,0 +1,4 @@ +module T13180 where + +data T +f :: T -> T ===================================== testsuite/tests/typecheck/T13180/T13180.stderr ===================================== @@ -0,0 +1,12 @@ +[1 of 3] Compiling T13180[boot] ( T13180.hs-boot, T13180.o-boot ) +[2 of 3] Compiling T13180A ( T13180A.hs, T13180A.o ) +[3 of 3] Compiling T13180 ( T13180.hs, T13180.o ) +T13180.hs-boot:3:1: error: [GHC-15843] + • Type constructor ‘T’ has conflicting definitions in the module + and its hs-boot file. + Main module: type T :: * + type T = Int + Boot file: type T :: * + data T + • In the type synonym declaration for ‘T’ + ===================================== testsuite/tests/typecheck/T13180/T13180A.hs ===================================== @@ -0,0 +1,3 @@ +module T13180A (f) where + +import {-# SOURCE #-} T13180 ===================================== testsuite/tests/typecheck/T13180/all.T ===================================== @@ -0,0 +1,8 @@ +# Historically this scenario resulted in a second error: +# +# Identifier ‘f’ has conflicting definitions in the module +# and its hs-boot file +# Main module: f :: T -> T +# Boot file: f :: T -> T +# The two types are different +test('T13180', normal, multimod_compile_fail, ['T13180', '-fforce-recomp']) ===================================== testsuite/tests/typecheck/should_compile/T11141.hs ===================================== @@ -0,0 +1,28 @@ +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE ScopedTypeVariables #-} +module T11141 where + +data F a = F a +instance Show a => Show (F a) where + show :: forall a. Show a => F a -> String + show (F x) = show x + +{- Previously emitted error: + + Could not deduce (Show a0) + from the context (Show a) + bound by the type signature for show :: Show a => F a -> String + at A.hs:8:13-45 + The type variable ‘a0’ is ambiguous + When checking that: + forall a. Show a => forall a1. Show a1 => F a1 -> String + is more polymorphic than: forall a. Show a => F a -> String + When checking that instance signature for ‘show’ + is more general than its signature in the class + Instance sig: forall a. + Show a => + forall a1. Show a1 => F a1 -> String + Class sig: forall a. Show a => F a -> String + In the instance declaration for ‘Show (F a)’ +-} ===================================== testsuite/tests/typecheck/should_compile/T11141.stderr ===================================== @@ -0,0 +1,4 @@ +T11141.hs:8:20: warning: [GHC-63397] [-Wname-shadowing (in -Wall)] + This binding for ‘a’ shadows the existing binding + bound at T11141.hs:7:10 + ===================================== testsuite/tests/typecheck/should_compile/T11505Bar.hs ===================================== @@ -0,0 +1,3 @@ +module T11505Bar where + +import {-# SOURCE #-} T11505Foo ===================================== testsuite/tests/typecheck/should_compile/T11505Foo.hs ===================================== @@ -0,0 +1,12 @@ +module T11505Foo where + +import T11505Bar + +-- #11505: this used to fail with: +-- +-- T11505Foo.hs:12:1: +-- Type constructor `Foo' has conflicting definitions in the module +-- and its hs-boot file +-- Main module: data Foo = Foo {x :: {-# UNPACK #-} !Int} +-- Boot file: data Foo = Foo {x :: !Int} +data Foo = Foo { x :: {-# UNPACK #-} !Int } ===================================== testsuite/tests/typecheck/should_compile/T11505Foo.hs-boot ===================================== @@ -0,0 +1,3 @@ +module T11505Foo where + +data Foo = Foo { x :: {-# UNPACK #-} !Int } ===================================== testsuite/tests/typecheck/should_compile/T12046.hs ===================================== @@ -0,0 +1,14 @@ +{-# LANGUAGE UndecidableSuperClasses #-} +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE TypeFamilies #-} +module T12046 where + +class A (T a) => A a where + type T a + +test1 :: forall a. A a => () +test1 = () + +test2 :: A a => proxy a -> () +test2 _ = () + ===================================== testsuite/tests/typecheck/should_compile/all.T ===================================== @@ -496,6 +496,7 @@ test('T10770b', expect_broken(10770), compile, ['']) test('T10935', normal, compile, ['']) test('T10971a', normal, compile, ['']) test('T11062', [extra_files(['T11062.hs', 'T11062.hs-boot', 'T11062a.hs'])], multimod_compile, ['T11062', '-v0']) +test('T11141', normal, compile, ['-Wname-shadowing']) test('T11237', normal, compile, ['']) test('T10592', normal, compile, ['']) test('T11305', normal, compile, ['']) @@ -507,6 +508,7 @@ test('RebindNegate', normal, compile, ['']) test('T11319', normal, compile, ['']) test('T11397', normal, compile, ['']) test('T11458', normal, compile, ['']) +test('T11505', [extra_files(['T11505Foo.hs', 'T11505Foo.hs-boot', 'T11505Bar.hs'])], multimod_compile, ['T11505Foo', '-v0']) test('T11506', normal, compile, ['']) test('T11524', normal, compile, ['']) test('T11552', normal, compile, ['']) @@ -525,6 +527,7 @@ test('T11982a', expect_broken(11982), compile, ['']) test('T11982b', expect_broken(11982), compile, ['']) test('T11982c', normal, compile, ['']) test('T12045a', normal, compile, ['']) +test('T12046', normal, compile, ['']) test('T12064', [], multimod_compile, ['T12064', '-v0']) test('ExPat', normal, compile, ['']) test('ExPatFail', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8490e91890ba3d4f5627edf6e4dbebe... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8490e91890ba3d4f5627edf6e4dbebe... You're receiving this email because of your account on gitlab.haskell.org.