Simon Jakobi pushed to branch wip/sjakobi/regression-tests-3 at Glasgow Haskell Compiler / GHC

Commits:

19 changed files:

Changes:

  • testsuite/tests/parser/should_compile/T12002.hs
    1
    +-- Test that the misplaced LANGUAGE pragma results in a warning but doesn't
    
    2
    +-- cause the program to be rejected.
    
    3
    +module T12002 where
    
    4
    +
    
    5
    +{-# LANGUAGE OverloadedStrings #-}

  • testsuite/tests/parser/should_compile/T12002.stderr
    1
    +T12002.hs:5:1: warning: [GHC-28007] [-Wmisplaced-pragmas (in -Wdefault)]
    
    2
    +    Misplaced LANGUAGE pragma
    
    3
    +    Suggested fix:
    
    4
    +      Perhaps you meant to place it in the module header?
    
    5
    +      The module header is the section at the top of the file, before the ‘module’ keyword
    
    6
    +

  • testsuite/tests/parser/should_compile/all.T
    ... ... @@ -116,6 +116,7 @@ test('DumpParsedAst', normal, compile, ['-dsuppress-uniques -ddump-parsed-a
    116 116
     test('DumpParsedAstComments',  normal, compile, ['-dsuppress-uniques -ddump-parsed-ast -dkeep-comments'])
    
    117 117
     test('DumpRenamedAst',     normal, compile, ['-dsuppress-uniques -ddump-rn-ast'])
    
    118 118
     test('DumpTypecheckedAst', normal, compile, ['-dsuppress-uniques -ddump-tc-ast'])
    
    119
    +test('T12002', normal, compile, [''])
    
    119 120
     test('T12045e', normal, compile, [''])
    
    120 121
     test('T13087', normal, compile, [''])
    
    121 122
     test('T13747', normal, compile, [''])
    

  • testsuite/tests/perf/compiler/T13820.hs
    1
    +-- Regression test for #13820. Instead of the original 27 `id`s, this
    
    2
    +-- test uses only 24, so a regression is less likely to result in an
    
    3
    +-- out-of-memory situation.
    
    4
    +f = id id id id
    
    5
    +    id id id id
    
    6
    +    id id id id
    
    7
    +    id id id id
    
    8
    +    id id id id
    
    9
    +    id id id id
    
    10
    +
    
    11
    +main = print 1

  • testsuite/tests/perf/compiler/all.T
    ... ... @@ -680,6 +680,12 @@ test ('T13253-spj',
    680 680
           ],
    
    681 681
           compile,
    
    682 682
           ['-v0 -O'])
    
    683
    +test ('T13820',
    
    684
    +      [ collect_compiler_stats('peak_megabytes_allocated', 5),
    
    685
    +        collect_compiler_stats('bytes allocated', 2),
    
    686
    +      ],
    
    687
    +      compile,
    
    688
    +      ['-v0'])
    
    683 689
     test ('T14766',
    
    684 690
           [ collect_compiler_stats('bytes allocated',2),
    
    685 691
             pre_cmd('python3 genT14766.py > T14766.hs'),
    

  • testsuite/tests/rebindable/T10381.hs
    1
    +{-# LANGUAGE RebindableSyntax, RankNTypes #-}
    
    2
    +
    
    3
    +module T10381 where
    
    4
    +
    
    5
    +import Prelude ( String, undefined )
    
    6
    +
    
    7
    +newtype Cont r a = Cont { runCont :: (forall i. a i -> r) -> r }
    
    8
    +
    
    9
    +(>>=) :: Cont r a -> (forall i. a i -> Cont r b) -> Cont r b
    
    10
    +ma >>= fmb
    
    11
    +  = Cont (\k -> runCont ma (\a -> runCont (fmb a) k))
    
    12
    +
    
    13
    +fail :: String -> Cont r a
    
    14
    +fail = undefined
    
    15
    +
    
    16
    +return :: a i -> Cont r a
    
    17
    +return x = Cont (\k -> k x)
    
    18
    +
    
    19
    +foo :: Cont r []
    
    20
    +foo = do
    
    21
    +  bar <- foo
    
    22
    +  return bar
    
    23
    +
    
    24
    +{- Previously, GHC used to reject this program with:
    
    25
    +
    
    26
    +    Couldn't match type ‘i0’ with ‘i’
    
    27
    +      because type variable ‘i’ would escape its scope
    
    28
    +    This (rigid, skolem) type variable is bound by
    
    29
    +      a type expected by the context: [i] -> Cont r []
    
    30
    +      at Bug.hs:21:3-12
    
    31
    +    Expected type: Cont r [] -> ([i0] -> Cont r []) -> Cont r []
    
    32
    +      Actual type: Cont r []
    
    33
    +                   -> (forall i. [i] -> Cont r []) -> Cont r []
    
    34
    +    In a stmt of a 'do' block: bar <- foo
    
    35
    +    In the expression:
    
    36
    +      do { bar <- foo;
    
    37
    +           return bar }
    
    38
    +    In an equation for ‘foo’:
    
    39
    +        foo
    
    40
    +          = do { bar <- foo;
    
    41
    +                 return bar }
    
    42
    +-}
    
    43
    +

  • testsuite/tests/rebindable/all.T
    ... ... @@ -35,6 +35,7 @@ test('T4851', normal, compile, [''])
    35 35
     
    
    36 36
     test('T5908', normal, compile, [''])
    
    37 37
     test('T10112', normal, compile, [''])
    
    38
    +test('T10381', normal, compile, [''])
    
    38 39
     test('T11216', normal, compile, [''])
    
    39 40
     test('T11216A', normal, compile, [''])
    
    40 41
     test('T12080', normal, compile, [''])
    

  • testsuite/tests/typecheck/T13180/T13180.hs
    1
    +module T13180 (T, f) where
    
    2
    +
    
    3
    +import qualified T13180A
    
    4
    +
    
    5
    +type T = Int
    
    6
    +
    
    7
    +f :: T -> T
    
    8
    +f x = T13180A.f x

  • testsuite/tests/typecheck/T13180/T13180.hs-boot
    1
    +module T13180 where
    
    2
    +
    
    3
    +data T
    
    4
    +f :: T -> T

  • testsuite/tests/typecheck/T13180/T13180.stderr
    1
    +[1 of 3] Compiling T13180[boot]     ( T13180.hs-boot, T13180.o-boot )
    
    2
    +[2 of 3] Compiling T13180A          ( T13180A.hs, T13180A.o )
    
    3
    +[3 of 3] Compiling T13180           ( T13180.hs, T13180.o )
    
    4
    +T13180.hs-boot:3:1: error: [GHC-15843]
    
    5
    +    • Type constructor ‘T’ has conflicting definitions in the module
    
    6
    +      and its hs-boot file.
    
    7
    +      Main module: type T :: *
    
    8
    +                   type T = Int
    
    9
    +        Boot file: type T :: *
    
    10
    +                   data T
    
    11
    +    • In the type synonym declaration for ‘T’
    
    12
    +

  • testsuite/tests/typecheck/T13180/T13180A.hs
    1
    +module T13180A (f) where
    
    2
    +
    
    3
    +import {-# SOURCE #-} T13180

  • testsuite/tests/typecheck/T13180/all.T
    1
    +# Historically this scenario resulted in a second error:
    
    2
    +# 
    
    3
    +#    Identifier ‘f’ has conflicting definitions in the module
    
    4
    +#    and its hs-boot file
    
    5
    +#    Main module: f :: T -> T
    
    6
    +#    Boot file:   f :: T -> T
    
    7
    +#    The two types are different
    
    8
    +test('T13180', normal, multimod_compile_fail, ['T13180', '-fforce-recomp'])

  • testsuite/tests/typecheck/should_compile/T11141.hs
    1
    +{-# LANGUAGE FunctionalDependencies #-}
    
    2
    +{-# LANGUAGE InstanceSigs #-}
    
    3
    +{-# LANGUAGE ScopedTypeVariables #-}
    
    4
    +module T11141 where
    
    5
    +
    
    6
    +data F a = F a
    
    7
    +instance Show a => Show (F a) where
    
    8
    +    show :: forall a. Show a => F a -> String
    
    9
    +    show (F x) = show x
    
    10
    +
    
    11
    +{- Previously emitted error:
    
    12
    +
    
    13
    +    Could not deduce (Show a0)
    
    14
    +    from the context (Show a)
    
    15
    +      bound by the type signature for show :: Show a => F a -> String
    
    16
    +      at A.hs:8:13-45
    
    17
    +    The type variable ‘a0’ is ambiguous
    
    18
    +    When checking that:
    
    19
    +        forall a. Show a => forall a1. Show a1 => F a1 -> String
    
    20
    +      is more polymorphic than: forall a. Show a => F a -> String
    
    21
    +    When checking that instance signature for ‘show’
    
    22
    +      is more general than its signature in the class
    
    23
    +      Instance sig: forall a.
    
    24
    +                    Show a =>
    
    25
    +                    forall a1. Show a1 => F a1 -> String
    
    26
    +         Class sig: forall a. Show a => F a -> String
    
    27
    +    In the instance declaration for ‘Show (F a)’
    
    28
    +-}

  • testsuite/tests/typecheck/should_compile/T11141.stderr
    1
    +T11141.hs:8:20: warning: [GHC-63397] [-Wname-shadowing (in -Wall)]
    
    2
    +    This binding for ‘a’ shadows the existing binding
    
    3
    +      bound at T11141.hs:7:10
    
    4
    +

  • testsuite/tests/typecheck/should_compile/T11505Bar.hs
    1
    +module T11505Bar where
    
    2
    +
    
    3
    +import {-# SOURCE #-} T11505Foo

  • testsuite/tests/typecheck/should_compile/T11505Foo.hs
    1
    +module T11505Foo where
    
    2
    +
    
    3
    +import T11505Bar
    
    4
    +
    
    5
    +-- #11505: this used to fail with:
    
    6
    +--
    
    7
    +-- T11505Foo.hs:12:1:
    
    8
    +--     Type constructor `Foo' has conflicting definitions in the module
    
    9
    +--     and its hs-boot file
    
    10
    +--     Main module: data Foo = Foo {x :: {-# UNPACK #-} !Int}
    
    11
    +--     Boot file:   data Foo = Foo {x :: !Int}
    
    12
    +data Foo = Foo { x :: {-# UNPACK #-} !Int }

  • testsuite/tests/typecheck/should_compile/T11505Foo.hs-boot
    1
    +module T11505Foo where
    
    2
    +
    
    3
    +data Foo = Foo { x :: {-# UNPACK #-} !Int }

  • testsuite/tests/typecheck/should_compile/T12046.hs
    1
    +{-# LANGUAGE UndecidableSuperClasses #-}
    
    2
    +{-# LANGUAGE AllowAmbiguousTypes #-}
    
    3
    +{-# LANGUAGE TypeFamilies #-}
    
    4
    +module T12046 where
    
    5
    +
    
    6
    +class A (T a) => A a where
    
    7
    +    type T a
    
    8
    +
    
    9
    +test1 :: forall a. A a => ()
    
    10
    +test1 = ()
    
    11
    +
    
    12
    +test2 :: A a => proxy a -> ()
    
    13
    +test2 _ = ()
    
    14
    +

  • testsuite/tests/typecheck/should_compile/all.T
    ... ... @@ -496,6 +496,7 @@ test('T10770b', expect_broken(10770), compile, [''])
    496 496
     test('T10935', normal, compile, [''])
    
    497 497
     test('T10971a', normal, compile, [''])
    
    498 498
     test('T11062', [extra_files(['T11062.hs', 'T11062.hs-boot', 'T11062a.hs'])], multimod_compile, ['T11062', '-v0'])
    
    499
    +test('T11141', normal, compile, ['-Wname-shadowing'])
    
    499 500
     test('T11237', normal, compile, [''])
    
    500 501
     test('T10592', normal, compile, [''])
    
    501 502
     test('T11305', normal, compile, [''])
    
    ... ... @@ -507,6 +508,7 @@ test('RebindNegate', normal, compile, [''])
    507 508
     test('T11319', normal, compile, [''])
    
    508 509
     test('T11397', normal, compile, [''])
    
    509 510
     test('T11458', normal, compile, [''])
    
    511
    +test('T11505', [extra_files(['T11505Foo.hs', 'T11505Foo.hs-boot', 'T11505Bar.hs'])], multimod_compile, ['T11505Foo', '-v0'])
    
    510 512
     test('T11506', normal, compile, [''])
    
    511 513
     test('T11524', normal, compile, [''])
    
    512 514
     test('T11552', normal, compile, [''])
    
    ... ... @@ -525,6 +527,7 @@ test('T11982a', expect_broken(11982), compile, [''])
    525 527
     test('T11982b', expect_broken(11982), compile, [''])
    
    526 528
     test('T11982c', normal, compile, [''])
    
    527 529
     test('T12045a', normal, compile, [''])
    
    530
    +test('T12046', normal, compile, [''])
    
    528 531
     test('T12064', [], multimod_compile, ['T12064', '-v0'])
    
    529 532
     test('ExPat', normal, compile, [''])
    
    530 533
     test('ExPatFail', normal, compile_fail, [''])