[Git][ghc/ghc][wip/T26115] Error message wibbles

Simon Peyton Jones pushed to branch wip/T26115 at Glasgow Haskell Compiler / GHC Commits: a78189b7 by Simon Peyton Jones at 2025-06-30T17:23:21+01:00 Error message wibbles - - - - - 19 changed files: - compiler/GHC/Tc/Errors.hs - testsuite/tests/impredicative/T17332.stderr - testsuite/tests/quantified-constraints/T15290a.stderr - testsuite/tests/quantified-constraints/T19690.stderr - testsuite/tests/quantified-constraints/T19921.stderr - testsuite/tests/quantified-constraints/T21006.stderr - testsuite/tests/simplCore/should_compile/T26117.hs - testsuite/tests/simplCore/should_compile/all.T - testsuite/tests/typecheck/should_compile/T12427a.stderr - testsuite/tests/typecheck/should_compile/TcSpecPragmas.stderr - testsuite/tests/typecheck/should_fail/T14605.hs - testsuite/tests/typecheck/should_fail/T14605.stderr - testsuite/tests/typecheck/should_fail/T15801.stderr - testsuite/tests/typecheck/should_fail/T18640a.stderr - testsuite/tests/typecheck/should_fail/T18640b.stderr - testsuite/tests/typecheck/should_fail/T19627.stderr - testsuite/tests/typecheck/should_fail/T21530b.stderr - testsuite/tests/typecheck/should_fail/T22912.stderr - testsuite/tests/typecheck/should_fail/tcfail174.stderr Changes: ===================================== compiler/GHC/Tc/Errors.hs ===================================== @@ -2220,8 +2220,10 @@ Warn of loopy local equalities that were dropped. mkQCErr :: HasDebugCallStack => SolverReportErrCtxt -> NonEmpty ErrorItem -> TcM SolverReport mkQCErr ctxt items + | item1 :| _ <- tryFilter (not . ei_suppress) items + -- Ignore multiple qc-errors on the same line = do { let msg = mkPlainMismatchMsg $ - CouldNotDeduce (getUserGivens ctxt) items Nothing + CouldNotDeduce (getUserGivens ctxt) (item1 :| []) Nothing ; return $ important ctxt msg } ===================================== testsuite/tests/impredicative/T17332.stderr ===================================== @@ -1,7 +1,6 @@ - T17332.hs:13:7: error: [GHC-05617] - • Could not solve: ‘a’ - arising from the head of a quantified constraint + • Could not solve: ‘forall (a :: Constraint). a’ arising from a use of ‘MkDict’ • In the expression: MkDict In an equation for ‘aux’: aux = MkDict + ===================================== testsuite/tests/quantified-constraints/T15290a.stderr ===================================== @@ -1,9 +1,9 @@ T15290a.hs:25:12: error: [GHC-18872] - • Couldn't match representation of type: m (Int, IntStateT m a1) - with that of: m (Int, StateT Int m a1) + • Couldn't match representation of type: forall a. + StateT Int m (StateT Int m a) -> StateT Int m a + with that of: forall a. + IntStateT m (IntStateT m a) -> IntStateT m a arising from a use of ‘coerce’ - Note: We cannot know what roles the parameters to ‘m’ have; - we must assume that the role is nominal. • In the expression: coerce @(forall a. StateT Int m (StateT Int m a) -> StateT Int m a) ===================================== testsuite/tests/quantified-constraints/T19690.stderr ===================================== @@ -1,10 +1,5 @@ - T19690.hs:12:16: error: [GHC-05617] - • Could not deduce ‘c’ - arising from the head of a quantified constraint - arising from a use of ‘go’ - from the context: Hold c - bound by a quantified context at T19690.hs:12:16-17 + • Could not solve: ‘Hold c => c’ arising from a use of ‘go’ • In the expression: go In an equation for ‘anythingDict’: anythingDict @@ -12,5 +7,4 @@ T19690.hs:12:16: error: [GHC-05617] where go :: (Hold c => c) => Dict c go = Dict - • Relevant bindings include - anythingDict :: Dict c (bound at T19690.hs:12:1) + ===================================== testsuite/tests/quantified-constraints/T19921.stderr ===================================== @@ -1,12 +1,6 @@ - T19921.hs:29:8: error: [GHC-05617] - • Could not deduce ‘r’ - arising from the head of a quantified constraint - arising from the head of a quantified constraint + • Could not solve: ‘((x \/ y) \/ z) ⇒ (x \/ (y \/ z))’ arising from a use of ‘Dict’ - from the context: (x \/ y) \/ z - bound by a quantified context at T19921.hs:29:8-11 - or from: (x ⇒ r, (y \/ z) ⇒ r) - bound by a quantified context at T19921.hs:29:8-11 • In the expression: Dict In an equation for ‘dict’: dict = Dict + ===================================== testsuite/tests/quantified-constraints/T21006.stderr ===================================== @@ -1,8 +1,7 @@ - T21006.hs:14:10: error: [GHC-05617] - • Could not deduce ‘c’ - arising from the head of a quantified constraint + • Could not solve: ‘forall b (c :: Constraint). + (Determines b, Determines c) => + c’ arising from the superclasses of an instance declaration - from the context: (Determines b, Determines c) - bound by a quantified context at T21006.hs:14:10-15 • In the instance declaration for ‘OpCode’ + ===================================== testsuite/tests/simplCore/should_compile/T26117.hs ===================================== @@ -1,5 +1,10 @@ {-# LANGUAGE UndecidableInstances, TypeFamilies #-} +{- In -ddump-simpl output we do not want to see + case == @(F Int) lvl2_sQO eta_B0 eta_B0 of { + where (==) is called at a known type +-} + module T26117 where type family F a ===================================== testsuite/tests/simplCore/should_compile/all.T ===================================== @@ -550,4 +550,6 @@ test('T25703a', [grep_errmsg(r'SPEC')], compile, ['-O -fpolymorphic-specialisati test('T26115', [grep_errmsg(r'DFun')], compile, ['-O -ddump-simpl -dsuppress-uniques']) test('T26116', normal, compile, ['-O -ddump-rules']) +test('T26117', [grep_errmsg(r'==')], compile, ['-O -ddump-simpl -dsuppress-uniques']) + ===================================== testsuite/tests/typecheck/should_compile/T12427a.stderr ===================================== @@ -1,4 +1,3 @@ - T12427a.hs:17:29: error: [GHC-91028] • Couldn't match expected type ‘p’ with actual type ‘(forall b. [b] -> [b]) -> Int’ @@ -24,12 +23,11 @@ T12427a.hs:28:6: error: [GHC-91028] • In the pattern: T1 _ x1 In a pattern binding: T1 _ x1 = undefined -T12427a.hs:41:6: error: [GHC-25897] - • Couldn't match type ‘b’ with ‘[b]’ +T12427a.hs:41:6: error: [GHC-83865] + • Couldn't match type: forall b. [b] -> [b] + with: forall a. a -> a Expected: (forall b. [b] -> [b]) -> Int Actual: (forall a. a -> a) -> Int - ‘b’ is a rigid type variable bound by - the type [b] -> [b] - at T12427a.hs:41:1-19 • In the pattern: T1 _ x3 In a pattern binding: T1 _ x3 = undefined + ===================================== testsuite/tests/typecheck/should_compile/TcSpecPragmas.stderr ===================================== @@ -8,8 +8,3 @@ TcSpecPragmas.hs:42:1: warning: [GHC-66582] [-Wuseless-specialisations (in -Wdef The pragma does not specialise away any class dictionaries, and neither is there any value specialisation. -TcSpecPragmas.hs:54:1: warning: [GHC-66582] [-Wuseless-specialisations (in -Wdefault)] - Dubious SPECIALISE pragma for ‘tyEq’. - The pragma does not specialise away any class dictionaries, - and neither is there any value specialisation. - ===================================== testsuite/tests/typecheck/should_fail/T14605.hs ===================================== @@ -6,6 +6,8 @@ -- -- The ticket #14605 has a much longer example that -- also fails; it does not use ImpredicativeTypes +-- +-- The error message is not great; but it's an obscure program module T14605 where ===================================== testsuite/tests/typecheck/should_fail/T14605.stderr ===================================== @@ -1,10 +1,8 @@ - -T14605.hs:14:13: error: [GHC-10283] - • Couldn't match representation of type ‘x’ with that of ‘()’ +T14605.hs:16:13: error: [GHC-18872] + • Couldn't match representation of type: forall x. () + with that of: forall x. x arising from a use of ‘coerce’ - ‘x’ is a rigid type variable bound by - the type () - at T14605.hs:14:1-49 • In the expression: coerce @(forall x. ()) @(forall x. x) In an equation for ‘duplicate’: duplicate = coerce @(forall x. ()) @(forall x. x) + ===================================== testsuite/tests/typecheck/should_fail/T15801.stderr ===================================== @@ -1,7 +1,6 @@ - -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 from the head of a quantified constraint +T15801.hs:52:10: error: [GHC-05617] + • Could not solve: ‘forall (op_a :: Op (*)) (b :: Op (*)). + op_a -#- b’ arising from the superclasses of an instance declaration • In the instance declaration for ‘OpRíki (Op (*))’ + ===================================== testsuite/tests/typecheck/should_fail/T18640a.stderr ===================================== @@ -1,9 +1,5 @@ - -T18640a.hs:12:1: error: [GHC-25897] - • Couldn't match kind ‘a’ with ‘*’ - Expected: forall (b :: k). * -> * - Actual: forall (b :: k). * -> a - ‘a’ is a rigid type variable bound by - the type family declaration for ‘F2’ - at T18640a.hs:12:17 +T18640a.hs:12:1: error: [GHC-83865] + • Couldn't match expected kind: forall (b :: k). * -> * + with actual kind: forall (b :: k). * -> a • In the type family declaration for ‘F2’ + ===================================== testsuite/tests/typecheck/should_fail/T18640b.stderr ===================================== @@ -1,12 +1,5 @@ - -T18640b.hs:14:10: error: [GHC-25897] - • Couldn't match kind ‘k’ with ‘a’ - Expected kind ‘forall b -> a’, but ‘F1’ has kind ‘forall k -> k’ - ‘k’ is a rigid type variable bound by - the type k - at T18640b.hs:14:3-11 - ‘a’ is a rigid type variable bound by - a family instance declaration - at T18640b.hs:14:6 +T18640b.hs:14:10: error: [GHC-83865] + • Expected kind ‘forall b -> a’, but ‘F1’ has kind ‘forall k -> k’ • In the type ‘F1’ In the type family declaration for ‘F3’ + ===================================== testsuite/tests/typecheck/should_fail/T19627.stderr ===================================== @@ -18,28 +18,3 @@ T19627.hs:108:3: error: [GHC-05617] Not (p a b) -> b <#- a In the class declaration for ‘Lol’ -T19627.hs:108:3: error: [GHC-05617] - • Could not deduce ‘Not (Not (p0 a1 b1)) ~ p0 a1 b1’ - arising from a superclass required to satisfy ‘Prop (p0 a1 b1)’, - arising from the head of a quantified constraint - arising from a superclass required to satisfy ‘Iso p0’, - arising from a superclass required to satisfy ‘Lol p0’, - arising from a type ambiguity check for - the type signature for ‘apartR’ - from the context: Lol p - bound by the type signature for: - apartR :: forall (p :: * -> * -> *) a b. - Lol p => - Not (p a b) -> b <#- a - at T19627.hs:108:3-34 - or from: (Prop a1, Prop b1) - bound by a quantified context at T19627.hs:108:3-34 - The type variable ‘p0’ is ambiguous - • In the ambiguity check for ‘apartR’ - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - When checking the class method: - apartR :: forall (p :: * -> * -> *) a b. - Lol p => - Not (p a b) -> b <#- a - In the class declaration for ‘Lol’ - ===================================== testsuite/tests/typecheck/should_fail/T21530b.stderr ===================================== @@ -1,8 +1,8 @@ - T21530b.hs:9:5: error: [GHC-83865] - • Couldn't match type: Eq a => a -> String - with: a -> String + • Couldn't match type: forall a. (Show a, Eq a) => a -> String + with: forall a. Show a => a -> String Expected: (forall a. Show a => a -> String) -> String Actual: (forall a. (Show a, Eq a) => a -> String) -> String • In the expression: f In an equation for ‘g’: g = f + ===================================== testsuite/tests/typecheck/should_fail/T22912.stderr ===================================== @@ -1,16 +1,6 @@ - -T22912.hs:17:16: error: [GHC-39999] - • Could not deduce ‘Implies c’ - arising from the head of a quantified constraint +T22912.hs:17:16: error: [GHC-05617] + • Could not solve: ‘Exactly (Implies c) => Implies c’ arising from a use of ‘go’ - from the context: Exactly (Implies c) - bound by a quantified context at T22912.hs:17:16-17 - Possible fix: - add (Implies c) to the context of - the type signature for: - anythingDict :: forall (c :: Constraint). Dict c - or If the constraint looks soluble from a superclass of the instance context, - read 'Undecidable instances and loopy superclasses' in the user manual • In the expression: go In an equation for ‘anythingDict’: anythingDict @@ -18,3 +8,4 @@ T22912.hs:17:16: error: [GHC-39999] where go :: (Exactly (Implies c) => Implies c) => Dict c go = Dict + ===================================== testsuite/tests/typecheck/should_fail/tcfail174.stderr ===================================== @@ -1,33 +1,22 @@ - -tcfail174.hs:20:14: error: [GHC-25897] - • Couldn't match type ‘a1’ with ‘a’ +tcfail174.hs:20:14: error: [GHC-83865] + • Couldn't match type: forall a1. a1 -> a1 + with: forall x. x -> a Expected: Capture (forall x. x -> a) Actual: Capture (forall a. a -> a) - ‘a1’ is a rigid type variable bound by - the type a -> a - at tcfail174.hs:20:1-14 - ‘a’ is a rigid type variable bound by - the inferred type of h1 :: Capture a - at tcfail174.hs:20:1-14 • In the first argument of ‘Capture’, namely ‘g’ In the expression: Capture g In an equation for ‘h1’: h1 = Capture g • Relevant bindings include h1 :: Capture a (bound at tcfail174.hs:20:1) -tcfail174.hs:23:14: error: [GHC-25897] - • Couldn't match type ‘a’ with ‘b’ +tcfail174.hs:23:14: error: [GHC-83865] + • Couldn't match type: forall a. a -> a + with: forall x. x -> b Expected: Capture (forall x. x -> b) Actual: Capture (forall a. a -> a) - ‘a’ is a rigid type variable bound by - the type a -> a - at tcfail174.hs:1:1 - ‘b’ is a rigid type variable bound by - the type signature for: - h2 :: forall b. Capture b - at tcfail174.hs:22:1-15 • In the first argument of ‘Capture’, namely ‘g’ In the expression: Capture g In an equation for ‘h2’: h2 = Capture g • Relevant bindings include h2 :: Capture b (bound at tcfail174.hs:23:1) + View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a78189b75f554af0fec8e5e03699bbd3... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a78189b75f554af0fec8e5e03699bbd3... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)