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