Simon Peyton Jones pushed to branch wip/T26746 at Glasgow Haskell Compiler / GHC Commits: 01a35008 by Simon Peyton Jones at 2026-01-09T09:58:29+00:00 Error message wibbles [skip ci] ...still needs documentation, but awaiting review first - - - - - 9 changed files: - testsuite/tests/deriving/should_fail/T8984.stderr - testsuite/tests/deriving/should_fail/deriving-via-fail.stderr - testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr - testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr - testsuite/tests/typecheck/should_fail/T15801.stderr - testsuite/tests/typecheck/should_fail/T22924b.stderr - testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs - testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr - testsuite/tests/typecheck/should_fail/all.T Changes: ===================================== testsuite/tests/deriving/should_fail/T8984.stderr ===================================== @@ -1,6 +1,6 @@ T8984.hs:7:46: error: [GHC-18872] - • Couldn't match representation of type: cat a (N cat a Int) - with that of: cat a (cat a Int) + • Couldn't match representation of type: cat a (cat a Int) + with that of: cat a (N cat a Int) arising from the coercion of the method ‘app’ from type ‘cat a (cat a Int)’ to type ‘N cat a (N cat a Int)’ Note: We cannot know what roles the parameters to ‘cat a’ have; ===================================== testsuite/tests/deriving/should_fail/deriving-via-fail.stderr ===================================== @@ -1,12 +1,12 @@ deriving-via-fail.hs:10:34: error: [GHC-10283] - • Couldn't match representation of type ‘a’ with that of ‘b’ + • Couldn't match representation of type ‘b’ with that of ‘a’ arising from the coercion of the method ‘showsPrec’ from type ‘Int -> Identity b -> ShowS’ to type ‘Int -> Foo1 a -> ShowS’ - ‘a’ is a rigid type variable bound by + ‘b’ is a rigid type variable bound by the deriving clause for ‘Show (Foo1 a)’ at deriving-via-fail.hs:10:34-37 - ‘b’ is a rigid type variable bound by + ‘a’ is a rigid type variable bound by the deriving clause for ‘Show (Foo1 a)’ at deriving-via-fail.hs:10:34-37 • When deriving the instance for (Show (Foo1 a)) ===================================== testsuite/tests/deriving/should_fail/deriving-via-fail4.stderr ===================================== @@ -1,17 +1,17 @@ deriving-via-fail4.hs:15:12: error: [GHC-18872] - • Couldn't match representation of type ‘Int’ with that of ‘Char’ + • Couldn't match representation of type ‘Char’ with that of ‘Int’ arising from the coercion of the method ‘==’ from type ‘Char -> Char -> Bool’ to type ‘F1 -> F1 -> Bool’ • When deriving the instance for (Eq F1) deriving-via-fail4.hs:18:13: error: [GHC-10283] - • Couldn't match representation of type ‘a1’ with that of ‘a2’ + • Couldn't match representation of type ‘a2’ with that of ‘a1’ arising from the coercion of the method ‘c’ from type ‘a -> a -> Bool’ to type ‘a -> F2 a1 -> Bool’ - ‘a1’ is a rigid type variable bound by + ‘a2’ is a rigid type variable bound by the deriving clause for ‘C a (F2 a1)’ at deriving-via-fail4.hs:18:13-15 - ‘a2’ is a rigid type variable bound by + ‘a1’ is a rigid type variable bound by the deriving clause for ‘C a (F2 a1)’ at deriving-via-fail4.hs:18:13-15 • When deriving the instance for (C a (F2 a1)) ===================================== testsuite/tests/deriving/should_fail/deriving-via-fail5.stderr ===================================== @@ -1,10 +1,10 @@ deriving-via-fail5.hs:8:1: error: [GHC-10283] - • Couldn't match representation of type ‘a’ with that of ‘b’ + • Couldn't match representation of type ‘b’ with that of ‘a’ arising from a use of ‘GHC.Internal.Prim.coerce’ - ‘a’ is a rigid type variable bound by + ‘b’ is a rigid type variable bound by the instance declaration at deriving-via-fail5.hs:(8,1)-(9,24) - ‘b’ is a rigid type variable bound by + ‘a’ is a rigid type variable bound by the instance declaration at deriving-via-fail5.hs:(8,1)-(9,24) • In the expression: @@ -25,12 +25,12 @@ deriving-via-fail5.hs:8:1: error: [GHC-10283] (bound at deriving-via-fail5.hs:8:1) deriving-via-fail5.hs:8:1: error: [GHC-10283] - • Couldn't match representation of type ‘a’ with that of ‘b’ + • Couldn't match representation of type ‘b’ with that of ‘a’ arising from a use of ‘GHC.Internal.Prim.coerce’ - ‘a’ is a rigid type variable bound by + ‘b’ is a rigid type variable bound by the instance declaration at deriving-via-fail5.hs:(8,1)-(9,24) - ‘b’ is a rigid type variable bound by + ‘a’ is a rigid type variable bound by the instance declaration at deriving-via-fail5.hs:(8,1)-(9,24) • In the expression: @@ -48,12 +48,12 @@ deriving-via-fail5.hs:8:1: error: [GHC-10283] show :: Foo4 a -> String (bound at deriving-via-fail5.hs:8:1) deriving-via-fail5.hs:8:1: error: [GHC-10283] - • Couldn't match representation of type ‘a’ with that of ‘b’ + • Couldn't match representation of type ‘b’ with that of ‘a’ arising from a use of ‘GHC.Internal.Prim.coerce’ - ‘a’ is a rigid type variable bound by + ‘b’ is a rigid type variable bound by the instance declaration at deriving-via-fail5.hs:(8,1)-(9,24) - ‘b’ is a rigid type variable bound by + ‘a’ is a rigid type variable bound by the instance declaration at deriving-via-fail5.hs:(8,1)-(9,24) • In the expression: ===================================== testsuite/tests/typecheck/should_fail/T15801.stderr ===================================== @@ -1,7 +1,8 @@ T15801.hs:52:10: error: [GHC-18872] - • Couldn't match representation of type: UnOp op_a -> UnOp b - with that of: op_a --> b - arising (via a quantified constraint) from the superclasses of an instance declaration + • Couldn't match representation of type: op_a --> b + with that of: UnOp op_a -> UnOp b + arising (via a quantified constraint) from + the superclasses of an instance declaration When trying to solve the quantified constraint forall (op_a :: Op (*)) (b :: Op (*)). op_a -#- b arising from the superclasses of an instance declaration ===================================== testsuite/tests/typecheck/should_fail/T22924b.stderr ===================================== @@ -1,6 +1,6 @@ T22924b.hs:10:5: error: [GHC-40404] • Reduction stack overflow; size = 201 - When simplifying the following constraint: Coercible [R] S + When simplifying the following constraint: Coercible S [R] • In the expression: coerce In an equation for ‘f’: f = coerce Suggested fix: ===================================== testsuite/tests/typecheck/should_fail/TcCoercibleFail.hs ===================================== @@ -20,15 +20,6 @@ foo4 = coerce $ one :: Down Int newtype Void = Void Void foo5 = coerce :: Void -> () - ------------------------------------- --- This next one generates an exponentially big type as it --- tries to unwrap. See comment:15 in #11518 --- Adding assertions that force the types can make us --- run out of space. -newtype VoidBad a = VoidBad (VoidBad (a,a)) -foo5' = coerce :: (VoidBad ()) -> () - ------------------------------------ -- This should fail with a context stack overflow 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] In the expression: coerce $ one :: Down Int In an equation for ‘foo4’: foo4 = coerce $ one :: Down Int -TcCoercibleFail.hs:21:8: error: [GHC-18872] - • Couldn't match representation of type ‘Void’ with that of ‘()’ - arising from a use of ‘coerce’ +TcCoercibleFail.hs:21:8: error: [GHC-40404] + • Reduction stack overflow; size = 201 + When simplifying the following constraint: Coercible () Void • In the expression: coerce :: Void -> () In an equation for ‘foo5’: foo5 = coerce :: Void -> () + Suggested fix: + Use -freduction-depth=0 to disable this check + (any upper bound you could choose might fail unpredictably with + minor updates to GHC, so disabling the check is recommended if + you're sure that type checking should terminate) -TcCoercibleFail.hs:30:9: error: [GHC-18872] - • Couldn't match representation of type ‘VoidBad ()’ - with that of ‘()’ - arising from a use of ‘coerce’ - • In the expression: coerce :: (VoidBad ()) -> () - In an equation for ‘foo5'’: foo5' = coerce :: (VoidBad ()) -> () - -TcCoercibleFail.hs:35:8: error: [GHC-40404] +TcCoercibleFail.hs:26:8: error: [GHC-40404] • Reduction stack overflow; size = 201 When simplifying the following constraint: - Coercible (Either Int (Fix (Either Int))) (Fix (Either Age)) + Coercible (Fix (Either Age)) (Either Int (Fix (Either Int))) • In the expression: coerce :: Fix (Either Int) -> Fix (Either Age) In an equation for ‘foo6’: foo6 = coerce :: Fix (Either Int) -> Fix (Either Age) @@ -60,10 +58,9 @@ TcCoercibleFail.hs:35:8: error: [GHC-40404] minor updates to GHC, so disabling the check is recommended if you're sure that type checking should terminate) -TcCoercibleFail.hs:36:8: error: [GHC-18872] - • Couldn't match representation of type ‘Either - Int (Fix (Either Int))’ - with that of ‘()’ +TcCoercibleFail.hs:27:8: error: [GHC-18872] + • Couldn't match representation of type ‘()’ + with that of ‘Either Int (Fix (Either Int))’ arising from a use of ‘coerce’ • In the expression: coerce :: Fix (Either Int) -> () 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, ['']) test('T8034', normal, compile_fail, ['']) test('T8142', normal, compile_fail, ['']) test('T8262', normal, compile_fail, ['']) - -# TcCoercibleFail times out with the compiler is compiled with -DDEBUG. -# This is expected (see comment in source file). -test('TcCoercibleFail', [when(compiler_debugged(), skip)], compile_fail, ['']) - +test('TcCoercibleFail', [], compile_fail, ['']) test('TcCoercibleFail2', [], compile_fail, ['']) test('TcCoercibleFail3', [], compile_fail, ['']) test('T8306', normal, compile_fail, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/01a35008fbf78e8dc2a12ef9610cda9c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/01a35008fbf78e8dc2a12ef9610cda9c... You're receiving this email because of your account on gitlab.haskell.org.