Simon Peyton Jones pushed to branch wip/T26746 at Glasgow Haskell Compiler / GHC

Commits:

9 changed files:

Changes:

  • testsuite/tests/deriving/should_fail/T8984.stderr
    1 1
     T8984.hs:7:46: error: [GHC-18872]
    
    2
    -    • Couldn't match representation of type: cat a (N cat a Int)
    
    3
    -                               with that of: cat a (cat a Int)
    
    2
    +    • Couldn't match representation of type: cat a (cat a Int)
    
    3
    +                               with that of: cat a (N cat a Int)
    
    4 4
             arising from the coercion of the method ‘app’
    
    5 5
               from type ‘cat a (cat a Int)’ to type ‘N cat a (N cat a Int)’
    
    6 6
           Note: We cannot know what roles the parameters to ‘cat a’ have;
    

  • testsuite/tests/deriving/should_fail/deriving-via-fail.stderr
    1 1
     deriving-via-fail.hs:10:34: error: [GHC-10283]
    
    2
    -    • Couldn't match representation of type ‘a’ with that of ‘b
    
    2
    +    • Couldn't match representation of type ‘b’ with that of ‘a
    
    3 3
             arising from the coercion of the method ‘showsPrec’
    
    4 4
               from type ‘Int -> Identity b -> ShowS’
    
    5 5
                 to type ‘Int -> Foo1 a -> ShowS’
    
    6
    -a’ is a rigid type variable bound by
    
    6
    +b’ is a rigid type variable bound by
    
    7 7
             the deriving clause for ‘Show (Foo1 a)’
    
    8 8
             at deriving-via-fail.hs:10:34-37
    
    9
    -b’ is a rigid type variable bound by
    
    9
    +a’ is a rigid type variable bound by
    
    10 10
             the deriving clause for ‘Show (Foo1 a)’
    
    11 11
             at deriving-via-fail.hs:10:34-37
    
    12 12
         • When deriving the instance for (Show (Foo1 a))
    

  • testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr
    1 1
     deriving-via-fail4.hs:15:12: error: [GHC-18872]
    
    2
    -    • Couldn't match representation of type ‘Int’ with that of ‘Char
    
    2
    +    • Couldn't match representation of type ‘Char’ with that of ‘Int
    
    3 3
             arising from the coercion of the method ‘==’
    
    4 4
               from type ‘Char -> Char -> Bool’ to type ‘F1 -> F1 -> Bool’
    
    5 5
         • When deriving the instance for (Eq F1)
    
    6 6
     
    
    7 7
     deriving-via-fail4.hs:18:13: error: [GHC-10283]
    
    8
    -    • Couldn't match representation of type ‘a1’ with that of ‘a2
    
    8
    +    • Couldn't match representation of type ‘a2’ with that of ‘a1
    
    9 9
             arising from the coercion of the method ‘c’
    
    10 10
               from type ‘a -> a -> Bool’ to type ‘a -> F2 a1 -> Bool’
    
    11
    -      ‘a1’ is a rigid type variable bound by
    
    11
    +      ‘a2’ is a rigid type variable bound by
    
    12 12
             the deriving clause for ‘C a (F2 a1)’
    
    13 13
             at deriving-via-fail4.hs:18:13-15
    
    14
    -      ‘a2’ is a rigid type variable bound by
    
    14
    +      ‘a1’ is a rigid type variable bound by
    
    15 15
             the deriving clause for ‘C a (F2 a1)’
    
    16 16
             at deriving-via-fail4.hs:18:13-15
    
    17 17
         • When deriving the instance for (C a (F2 a1))
    

  • testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr
    1 1
     deriving-via-fail5.hs:8:1: error: [GHC-10283]
    
    2
    -    • Couldn't match representation of type ‘a’ with that of ‘b
    
    2
    +    • Couldn't match representation of type ‘b’ with that of ‘a
    
    3 3
             arising from a use of ‘GHC.Internal.Prim.coerce’
    
    4
    -a’ is a rigid type variable bound by
    
    4
    +b’ is a rigid type variable bound by
    
    5 5
             the instance declaration
    
    6 6
             at deriving-via-fail5.hs:(8,1)-(9,24)
    
    7
    -b’ is a rigid type variable bound by
    
    7
    +a’ is a rigid type variable bound by
    
    8 8
             the instance declaration
    
    9 9
             at deriving-via-fail5.hs:(8,1)-(9,24)
    
    10 10
         • In the expression:
    
    ... ... @@ -25,12 +25,12 @@ deriving-via-fail5.hs:8:1: error: [GHC-10283]
    25 25
               (bound at deriving-via-fail5.hs:8:1)
    
    26 26
     
    
    27 27
     deriving-via-fail5.hs:8:1: error: [GHC-10283]
    
    28
    -    • Couldn't match representation of type ‘a’ with that of ‘b
    
    28
    +    • Couldn't match representation of type ‘b’ with that of ‘a
    
    29 29
             arising from a use of ‘GHC.Internal.Prim.coerce’
    
    30
    -a’ is a rigid type variable bound by
    
    30
    +b’ is a rigid type variable bound by
    
    31 31
             the instance declaration
    
    32 32
             at deriving-via-fail5.hs:(8,1)-(9,24)
    
    33
    -b’ is a rigid type variable bound by
    
    33
    +a’ is a rigid type variable bound by
    
    34 34
             the instance declaration
    
    35 35
             at deriving-via-fail5.hs:(8,1)-(9,24)
    
    36 36
         • In the expression:
    
    ... ... @@ -48,12 +48,12 @@ deriving-via-fail5.hs:8:1: error: [GHC-10283]
    48 48
             show :: Foo4 a -> String (bound at deriving-via-fail5.hs:8:1)
    
    49 49
     
    
    50 50
     deriving-via-fail5.hs:8:1: error: [GHC-10283]
    
    51
    -    • Couldn't match representation of type ‘a’ with that of ‘b
    
    51
    +    • Couldn't match representation of type ‘b’ with that of ‘a
    
    52 52
             arising from a use of ‘GHC.Internal.Prim.coerce’
    
    53
    -a’ is a rigid type variable bound by
    
    53
    +b’ is a rigid type variable bound by
    
    54 54
             the instance declaration
    
    55 55
             at deriving-via-fail5.hs:(8,1)-(9,24)
    
    56
    -b’ is a rigid type variable bound by
    
    56
    +a’ is a rigid type variable bound by
    
    57 57
             the instance declaration
    
    58 58
             at deriving-via-fail5.hs:(8,1)-(9,24)
    
    59 59
         • In the expression:
    

  • testsuite/tests/typecheck/should_fail/T15801.stderr
    1 1
     T15801.hs:52:10: error: [GHC-18872]
    
    2
    -    • Couldn't match representation of type: UnOp op_a -> UnOp b
    
    3
    -                               with that of: op_a --> b
    
    4
    -        arising (via a quantified constraint) from the superclasses of an instance declaration
    
    2
    +    • Couldn't match representation of type: op_a --> b
    
    3
    +                               with that of: UnOp op_a -> UnOp b
    
    4
    +        arising (via a quantified constraint) from
    
    5
    +          the superclasses of an instance declaration
    
    5 6
           When trying to solve the quantified constraint
    
    6 7
             forall (op_a :: Op (*)) (b :: Op (*)). op_a -#- b
    
    7 8
             arising from the superclasses of an instance declaration
    

  • testsuite/tests/typecheck/should_fail/T22924b.stderr
    1 1
     T22924b.hs:10:5: error: [GHC-40404]
    
    2 2
         • Reduction stack overflow; size = 201
    
    3
    -      When simplifying the following constraint: Coercible [R] S
    
    3
    +      When simplifying the following constraint: Coercible S [R]
    
    4 4
         • In the expression: coerce
    
    5 5
           In an equation for ‘f’: f = coerce
    
    6 6
         Suggested fix:
    

  • testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs
    ... ... @@ -20,15 +20,6 @@ foo4 = coerce $ one :: Down Int
    20 20
     newtype Void = Void Void
    
    21 21
     foo5 = coerce :: Void -> ()
    
    22 22
     
    
    23
    -
    
    24
    -------------------------------------
    
    25
    --- This next one generates an exponentially big type as it
    
    26
    --- tries to unwrap.  See comment:15 in #11518
    
    27
    --- Adding assertions that force the types can make us
    
    28
    --- run out of space.
    
    29
    -newtype VoidBad a = VoidBad (VoidBad (a,a))
    
    30
    -foo5' = coerce :: (VoidBad ()) -> ()
    
    31
    -
    
    32 23
     ------------------------------------
    
    33 24
     -- This should fail with a context stack overflow
    
    34 25
     newtype Fix f = Fix (f (Fix f))
    

  • testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr
    ... ... @@ -34,23 +34,21 @@ TcCoercibleFail.hs:18:8: error: [GHC-18872]
    34 34
           In the expression: coerce $ one :: Down Int
    
    35 35
           In an equation for ‘foo4’: foo4 = coerce $ one :: Down Int
    
    36 36
     
    
    37
    -TcCoercibleFail.hs:21:8: error: [GHC-18872]
    
    38
    -Couldn't match representation of type ‘Void’ with that of ‘()’
    
    39
    -        arising from a use of ‘coerce’
    
    37
    +TcCoercibleFail.hs:21:8: error: [GHC-40404]
    
    38
    +Reduction stack overflow; size = 201
    
    39
    +      When simplifying the following constraint: Coercible () Void
    
    40 40
         • In the expression: coerce :: Void -> ()
    
    41 41
           In an equation for ‘foo5’: foo5 = coerce :: Void -> ()
    
    42
    +    Suggested fix:
    
    43
    +      Use -freduction-depth=0 to disable this check
    
    44
    +      (any upper bound you could choose might fail unpredictably with
    
    45
    +       minor updates to GHC, so disabling the check is recommended if
    
    46
    +       you're sure that type checking should terminate)
    
    42 47
     
    
    43
    -TcCoercibleFail.hs:30:9: error: [GHC-18872]
    
    44
    -    • Couldn't match representation of type ‘VoidBad ()’
    
    45
    -                               with that of ‘()’
    
    46
    -        arising from a use of ‘coerce’
    
    47
    -    • In the expression: coerce :: (VoidBad ()) -> ()
    
    48
    -      In an equation for ‘foo5'’: foo5' = coerce :: (VoidBad ()) -> ()
    
    49
    -
    
    50
    -TcCoercibleFail.hs:35:8: error: [GHC-40404]
    
    48
    +TcCoercibleFail.hs:26:8: error: [GHC-40404]
    
    51 49
         • Reduction stack overflow; size = 201
    
    52 50
           When simplifying the following constraint:
    
    53
    -        Coercible (Either Int (Fix (Either Int))) (Fix (Either Age))
    
    51
    +        Coercible (Fix (Either Age)) (Either Int (Fix (Either Int)))
    
    54 52
         • In the expression: coerce :: Fix (Either Int) -> Fix (Either Age)
    
    55 53
           In an equation for ‘foo6’:
    
    56 54
               foo6 = coerce :: Fix (Either Int) -> Fix (Either Age)
    
    ... ... @@ -60,10 +58,9 @@ TcCoercibleFail.hs:35:8: error: [GHC-40404]
    60 58
            minor updates to GHC, so disabling the check is recommended if
    
    61 59
            you're sure that type checking should terminate)
    
    62 60
     
    
    63
    -TcCoercibleFail.hs:36:8: error: [GHC-18872]
    
    64
    -    • Couldn't match representation of type ‘Either
    
    65
    -                                               Int (Fix (Either Int))’
    
    66
    -                               with that of ‘()’
    
    61
    +TcCoercibleFail.hs:27:8: error: [GHC-18872]
    
    62
    +    • Couldn't match representation of type ‘()’
    
    63
    +                               with that of ‘Either Int (Fix (Either Int))’
    
    67 64
             arising from a use of ‘coerce’
    
    68 65
         • In the expression: coerce :: Fix (Either Int) -> ()
    
    69 66
           In an equation for ‘foo7’: foo7 = coerce :: Fix (Either Int) -> ()
    

  • testsuite/tests/typecheck/should_fail/all.T
    ... ... @@ -326,11 +326,7 @@ test('T7989', normal, compile_fail, [''])
    326 326
     test('T8034', normal, compile_fail, [''])
    
    327 327
     test('T8142', normal, compile_fail, [''])
    
    328 328
     test('T8262', normal, compile_fail, [''])
    
    329
    -
    
    330
    -# TcCoercibleFail times out with the compiler is compiled with -DDEBUG.
    
    331
    -# This is expected (see comment in source file).
    
    332
    -test('TcCoercibleFail', [when(compiler_debugged(), skip)], compile_fail, [''])
    
    333
    -
    
    329
    +test('TcCoercibleFail', [], compile_fail, [''])
    
    334 330
     test('TcCoercibleFail2', [], compile_fail, [''])
    
    335 331
     test('TcCoercibleFail3', [], compile_fail, [''])
    
    336 332
     test('T8306', normal, compile_fail, [''])