diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-04-08 23:08:12 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-22 23:13:06 -0400 |
commit | ffde234854f49dba9ec4735aad74b30fd2deee29 (patch) | |
tree | 80409f70e0de9164441d1cf860b386df4318e5c3 /testsuite | |
parent | 34a45ee600d5346f5d1728047fa185698ed7ee84 (diff) | |
download | haskell-ffde234854f49dba9ec4735aad74b30fd2deee29.tar.gz |
Do eager instantation in terms
This patch implements eager instantiation, a small but critical change
to the type inference engine, #17173. The main change is this:
When inferring types, always return an instantiated type
(for now, deeply instantiated; in future shallowly instantiated)
There is more discussion in
https://www.tweag.io/posts/2020-04-02-lazy-eager-instantiation.html
There is quite a bit of refactoring in this patch:
* The ir_inst field of GHC.Tc.Utils.TcType.InferResultk
has entirely gone. So tcInferInst and tcInferNoInst have collapsed
into tcInfer.
* Type inference of applications, via tcInferApp and
tcInferAppHead, are substantially refactored, preparing
the way for Quick Look impredicativity.
* New pure function GHC.Tc.Gen.Expr.collectHsArgs and applyHsArgs
are beatifully dual. We can see the zipper!
* GHC.Tc.Gen.Expr.tcArgs is now much nicer; no longer needs to return
a wrapper
* In HsExpr, HsTypeApp now contains the the actual type argument,
and is used in desugaring, rather than putting it in a mysterious
wrapper.
* I struggled a bit with good error reporting in
Unify.matchActualFunTysPart. It's a little bit simpler than before,
but still not great.
Some smaller things
* Rename tcPolyExpr --> tcCheckExpr
tcMonoExpr --> tcLExpr
* tcPatSig moves from GHC.Tc.Gen.HsType to GHC.Tc.Gen.Pat
Metric Decrease:
T9961
Reduction of 1.6% in comiler allocation on T9961, I think.
Diffstat (limited to 'testsuite')
46 files changed, 147 insertions, 120 deletions
diff --git a/testsuite/tests/ado/T13242a.stderr b/testsuite/tests/ado/T13242a.stderr index 039830e63a..9e32035ebb 100644 --- a/testsuite/tests/ado/T13242a.stderr +++ b/testsuite/tests/ado/T13242a.stderr @@ -11,7 +11,7 @@ T13242a.hs:10:5: error: _ <- return 'a' _ <- return 'b' return (x == x) - • In an equation for ‘test’: + In an equation for ‘test’: test = do A x <- undefined _ <- return 'a' @@ -19,7 +19,7 @@ T13242a.hs:10:5: error: return (x == x) • Relevant bindings include x :: a (bound at T13242a.hs:10:5) -T13242a.hs:13:11: error: +T13242a.hs:13:13: error: • Ambiguous type variable ‘a0’ arising from a use of ‘==’ prevents the constraint ‘(Eq a0)’ from being solved. Relevant bindings include x :: a0 (bound at T13242a.hs:10:5) @@ -27,12 +27,12 @@ T13242a.hs:13:11: error: These potential instances exist: instance Eq Ordering -- Defined in ‘GHC.Classes’ instance Eq Integer - -- Defined in ‘integer-gmp-1.0.2.0:GHC.Integer.Type’ + -- Defined in ‘integer-gmp-1.0.3.0:GHC.Integer.Type’ instance Eq () -- Defined in ‘GHC.Classes’ ...plus 21 others ...plus six instances involving out-of-scope types (use -fprint-potential-instances to see them all) - In a stmt of a 'do' block: return (x == x) + • In a stmt of a 'do' block: return (x == x) In the expression: do A x <- undefined _ <- return 'a' diff --git a/testsuite/tests/ado/ado002.stderr b/testsuite/tests/ado/ado002.stderr index c2fb6b63b1..d7c0b6da68 100644 --- a/testsuite/tests/ado/ado002.stderr +++ b/testsuite/tests/ado/ado002.stderr @@ -2,8 +2,8 @@ ado002.hs:8:8: error: • Couldn't match expected type ‘Char -> IO b0’ with actual type ‘IO Char’ - • The function ‘getChar’ is applied to one argument, - but its type ‘IO Char’ has none + • The function ‘getChar’ is applied to one value argument, + but its type ‘IO Char’ has none In a stmt of a 'do' block: y <- getChar 'a' In the expression: do x <- getChar @@ -45,8 +45,8 @@ ado002.hs:15:13: error: ado002.hs:23:9: error: • Couldn't match expected type ‘Char -> IO t0’ with actual type ‘IO Char’ - • The function ‘getChar’ is applied to one argument, - but its type ‘IO Char’ has none + • The function ‘getChar’ is applied to one value argument, + but its type ‘IO Char’ has none In a stmt of a 'do' block: x5 <- getChar x4 In the expression: do x1 <- getChar diff --git a/testsuite/tests/annotations/should_fail/annfail08.stderr b/testsuite/tests/annotations/should_fail/annfail08.stderr index 47a54243fe..6fafaf919e 100644 --- a/testsuite/tests/annotations/should_fail/annfail08.stderr +++ b/testsuite/tests/annotations/should_fail/annfail08.stderr @@ -5,7 +5,7 @@ annfail08.hs:9:1: error: (maybe you haven't applied a function to enough arguments?) • In the annotation: {-# ANN f (id + 1) #-} -annfail08.hs:9:12: error: +annfail08.hs:9:15: error: • No instance for (Num (a0 -> a0)) arising from a use of ‘+’ (maybe you haven't applied a function to enough arguments?) • In the annotation: {-# ANN f (id + 1) #-} diff --git a/testsuite/tests/driver/T2182.stderr b/testsuite/tests/driver/T2182.stderr index 770135a338..6689c717bb 100644 --- a/testsuite/tests/driver/T2182.stderr +++ b/testsuite/tests/driver/T2182.stderr @@ -5,7 +5,7 @@ T2182.hs:5:5: error: • In the expression: show (\ x -> x) In an equation for ‘y’: y = show (\ x -> x) -T2182.hs:6:5: error: +T2182.hs:6:15: error: • No instance for (Eq (p0 -> p0)) arising from a use of ‘==’ (maybe you haven't applied a function to enough arguments?) • In the expression: (\ x -> x) == (\ y -> y) @@ -17,7 +17,7 @@ T2182.hs:5:5: error: • In the expression: show (\ x -> x) In an equation for ‘y’: y = show (\ x -> x) -T2182.hs:6:5: error: +T2182.hs:6:15: error: • No instance for (Eq (p0 -> p0)) arising from a use of ‘==’ (maybe you haven't applied a function to enough arguments?) • In the expression: (\ x -> x) == (\ y -> y) diff --git a/testsuite/tests/gadt/gadt13.stderr b/testsuite/tests/gadt/gadt13.stderr index 6673ff68b0..cea221944b 100644 --- a/testsuite/tests/gadt/gadt13.stderr +++ b/testsuite/tests/gadt/gadt13.stderr @@ -8,10 +8,10 @@ gadt13.hs:15:13: error: in an equation for ‘shw’ at gadt13.hs:15:6-8 ‘p’ is a rigid type variable bound by - the inferred type of shw :: Term a -> p at gadt13.hs:15:1-30 + the inferred type of shw :: Term a -> p + at gadt13.hs:15:1-30 Possible fix: add a type signature for ‘shw’ - • Possible cause: ‘(.)’ is applied to too many arguments - In the expression: ("I " ++) . shows t + • In the expression: ("I " ++) . shows t In an equation for ‘shw’: shw (I t) = ("I " ++) . shows t • Relevant bindings include shw :: Term a -> p (bound at gadt13.hs:15:1) diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index 63dbc9b042..0defd52b38 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -26,8 +26,8 @@ Defer01.hs:25:4: warning: [-Winaccessible-code (in -Wdefault)] Defer01.hs:31:5: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one argument, - but its type ‘Char’ has none + • The function ‘e’ is applied to one value argument, + but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' • Relevant bindings include f :: t (bound at Defer01.hs:31:1) @@ -79,7 +79,7 @@ Defer01.hs:50:5: warning: [-Wdeferred-type-errors (in -Wdefault)] • In the expression: 'p' In an equation for ‘a’: a = 'p' (deferred type error) -*** Exception: Defer01.hs:18:7: error: +*** Exception: Defer01.hs:18:9: error: • No instance for (Eq B) arising from a use of ‘==’ • In the expression: x == x In an equation for ‘b’: b x = x == x @@ -100,8 +100,8 @@ Defer01.hs:50:5: warning: [-Wdeferred-type-errors (in -Wdefault)] (deferred type error) *** Exception: Defer01.hs:31:5: error: • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - • The function ‘e’ is applied to one argument, - but its type ‘Char’ has none + • The function ‘e’ is applied to one value argument, + but its type ‘Char’ has none In the expression: e 'q' In an equation for ‘f’: f = e 'q' • Relevant bindings include f :: t (bound at Defer01.hs:31:1) diff --git a/testsuite/tests/ghci/scripts/T10963.stderr b/testsuite/tests/ghci/scripts/T10963.stderr index 2efd138be8..aa081391c4 100644 --- a/testsuite/tests/ghci/scripts/T10963.stderr +++ b/testsuite/tests/ghci/scripts/T10963.stderr @@ -1,12 +1,13 @@ <interactive>:1:1: error: - Ambiguous type variable ‘a0’ arising from a use of ‘foo’ - prevents the constraint ‘(Num a0)’ from being solved. - Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: - instance Num Integer -- Defined in ‘GHC.Num’ - instance Num Double -- Defined in ‘GHC.Float’ - instance Num Float -- Defined in ‘GHC.Float’ - ...plus two others - ...plus 8 instances involving out-of-scope types - (use -fprint-potential-instances to see them all) + • Ambiguous type variable ‘a0’ arising from a use of ‘foo’ + prevents the constraint ‘(Num a0)’ from being solved. + Probable fix: use a type annotation to specify what ‘a0’ should be. + These potential instances exist: + instance Num Integer -- Defined in ‘GHC.Num’ + instance Num Double -- Defined in ‘GHC.Float’ + instance Num Float -- Defined in ‘GHC.Float’ + ...plus two others + ...plus 8 instances involving out-of-scope types + (use -fprint-potential-instances to see them all) + • In the expression: foo diff --git a/testsuite/tests/ghci/scripts/ghci047.stderr b/testsuite/tests/ghci/scripts/ghci047.stderr index 86130800b0..90a9bb7c60 100644 --- a/testsuite/tests/ghci/scripts/ghci047.stderr +++ b/testsuite/tests/ghci/scripts/ghci047.stderr @@ -2,11 +2,13 @@ <interactive>:40:1: error: • Couldn't match type ‘HFalse’ with ‘HTrue’ arising from a use of ‘f’ - • In the expression: f $ Baz 'a' + • In the first argument of ‘($)’, namely ‘f’ + In the expression: f $ Baz 'a' In an equation for ‘it’: it = f $ Baz 'a' <interactive>:41:1: error: • Couldn't match type ‘HFalse’ with ‘HTrue’ arising from a use of ‘f’ - • In the expression: f $ Quz + • In the first argument of ‘($)’, namely ‘f’ + In the expression: f $ Quz In an equation for ‘it’: it = f $ Quz diff --git a/testsuite/tests/indexed-types/should_compile/T10806.stderr b/testsuite/tests/indexed-types/should_compile/T10806.stderr index 3503105498..c78a10bd7b 100644 --- a/testsuite/tests/indexed-types/should_compile/T10806.stderr +++ b/testsuite/tests/indexed-types/should_compile/T10806.stderr @@ -1,9 +1,9 @@ T10806.hs:11:32: error: - Couldn't match expected type ‘Char -> Bool’ - with actual type ‘IO ()’ - The function ‘print’ is applied to two arguments, - but its type ‘Char -> IO ()’ has only one - In the expression: print 'x' 'y' - In an equation for ‘triggersLoop’: - triggersLoop (Q _ _) (Q _ _) = print 'x' 'y' + • Couldn't match expected type ‘Char -> Bool’ + with actual type ‘IO ()’ + • The function ‘print’ is applied to two value arguments, + but its type ‘Char -> IO ()’ has only one + In the expression: print 'x' 'y' + In an equation for ‘triggersLoop’: + triggersLoop (Q _ _) (Q _ _) = print 'x' 'y' diff --git a/testsuite/tests/indexed-types/should_fail/T4485.stderr b/testsuite/tests/indexed-types/should_fail/T4485.stderr index 4cf3b153fd..bdf5218b42 100644 --- a/testsuite/tests/indexed-types/should_fail/T4485.stderr +++ b/testsuite/tests/indexed-types/should_fail/T4485.stderr @@ -13,11 +13,10 @@ T4485.hs:50:15: error: (The choice depends on the instantiation of ‘m0’ To pick the first instance above, use IncoherentInstances when compiling the other instance declarations) - • In the expression: asChild $ (genElement "foo") + • In the first argument of ‘($)’, namely ‘asChild’ + In the expression: asChild $ (genElement "foo") In an equation for ‘asChild’: asChild b = asChild $ (genElement "foo") - In the instance declaration for - ‘EmbedAsChild (IdentityT IO) FooBar’ T4485.hs:50:26: error: • Ambiguous type variable ‘m0’ arising from a use of ‘genElement’ diff --git a/testsuite/tests/indexed-types/should_fail/T8518.stderr b/testsuite/tests/indexed-types/should_fail/T8518.stderr index 037bb76bbe..b18202fec9 100644 --- a/testsuite/tests/indexed-types/should_fail/T8518.stderr +++ b/testsuite/tests/indexed-types/should_fail/T8518.stderr @@ -2,8 +2,8 @@ T8518.hs:14:18: error: • Couldn't match expected type ‘Z c -> B c -> Maybe (F c)’ with actual type ‘F c’ - • The function ‘rpt’ is applied to four arguments, - but its type ‘Int -> c -> F c’ has only two + • The function ‘rpt’ is applied to four value arguments, + but its type ‘Int -> c -> F c’ has only two In the expression: rpt (4 :: Int) c z b In an equation for ‘callCont’: callCont c z b diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail07.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail07.stderr index 73a1b9b4d8..836b27f9e5 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail07.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedrecfldsfail07.stderr @@ -1,7 +1,6 @@ overloadedrecfldsfail07.hs:7:7: error: • Couldn't match expected type ‘T’ with actual type ‘T -> Int’ - • Probable cause: ‘x’ is applied to too few arguments - In the first argument of ‘x’, namely ‘x’ + • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘y’: y = x x diff --git a/testsuite/tests/parser/should_compile/T2245.stderr b/testsuite/tests/parser/should_compile/T2245.stderr index b6c20a804e..b823c00ed0 100644 --- a/testsuite/tests/parser/should_compile/T2245.stderr +++ b/testsuite/tests/parser/should_compile/T2245.stderr @@ -13,7 +13,7 @@ T2245.hs:5:10: warning: [-Wmissing-methods (in -Wdefault)] T2245.hs:7:27: warning: [-Wtype-defaults (in -Wall)] • Defaulting the following constraints to type ‘T’ - (Ord a0) arising from a use of ‘<’ at T2245.hs:7:27-33 + (Ord a0) arising from a use of ‘<’ at T2245.hs:7:27 (Fractional a0) arising from the literal ‘1e400’ at T2245.hs:7:29-33 (Read a0) arising from a use of ‘read’ at T2245.hs:7:38-41 diff --git a/testsuite/tests/quantified-constraints/T17458.stderr b/testsuite/tests/quantified-constraints/T17458.stderr index b8468266dd..f77f26efb9 100644 --- a/testsuite/tests/quantified-constraints/T17458.stderr +++ b/testsuite/tests/quantified-constraints/T17458.stderr @@ -1,5 +1,5 @@ -T17458.hs:32:27: error: +T17458.hs:32:32: error: • Reduction stack overflow; size = 201 When simplifying the following type: Typeable Void Use -freduction-depth=0 to disable this check diff --git a/testsuite/tests/th/T5358.stderr b/testsuite/tests/th/T5358.stderr index 6561e08032..78ad520e46 100644 --- a/testsuite/tests/th/T5358.stderr +++ b/testsuite/tests/th/T5358.stderr @@ -1,18 +1,18 @@ T5358.hs:7:1: error: • Couldn't match expected type ‘Int’ with actual type ‘p1 -> p1’ - • The equation(s) for ‘t1’ have one argument, - but its type ‘Int’ has none + • The equation(s) for ‘t1’ have one value argument, + but its type ‘Int’ has none T5358.hs:8:1: error: • Couldn't match expected type ‘Int’ with actual type ‘p0 -> p0’ - • The equation(s) for ‘t2’ have one argument, - but its type ‘Int’ has none + • The equation(s) for ‘t2’ have one value argument, + but its type ‘Int’ has none T5358.hs:10:13: error: • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t1’ is applied to one argument, - but its type ‘Int’ has none + • The function ‘t1’ is applied to one value argument, + but its type ‘Int’ has none In the first argument of ‘(==)’, namely ‘t1 x’ In the expression: t1 x == t2 x • Relevant bindings include @@ -21,8 +21,8 @@ T5358.hs:10:13: error: T5358.hs:10:21: error: • Couldn't match expected type ‘t -> a0’ with actual type ‘Int’ - • The function ‘t2’ is applied to one argument, - but its type ‘Int’ has none + • The function ‘t2’ is applied to one value argument, + but its type ‘Int’ has none In the second argument of ‘(==)’, namely ‘t2 x’ In the expression: t1 x == t2 x • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_compile/FD1.stderr b/testsuite/tests/typecheck/should_compile/FD1.stderr index 380be215bc..64a01c43e1 100644 --- a/testsuite/tests/typecheck/should_compile/FD1.stderr +++ b/testsuite/tests/typecheck/should_compile/FD1.stderr @@ -5,6 +5,6 @@ FD1.hs:16:1: error: the type signature for: plus :: forall a. E a (Int -> Int) => Int -> a at FD1.hs:15:1-38 - • The equation(s) for ‘plus’ have two arguments, - but its type ‘Int -> a’ has only one + • The equation(s) for ‘plus’ have two value arguments, + but its type ‘Int -> a’ has only one • Relevant bindings include plus :: Int -> a (bound at FD1.hs:16:1) diff --git a/testsuite/tests/typecheck/should_compile/T13050.stderr b/testsuite/tests/typecheck/should_compile/T13050.stderr index 87b1312b4b..89f2b80d3b 100644 --- a/testsuite/tests/typecheck/should_compile/T13050.stderr +++ b/testsuite/tests/typecheck/should_compile/T13050.stderr @@ -87,8 +87,7 @@ T13050.hs:4:9: warning: [-Wtyped-holes (in -Wdefault)] T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: Int -> Int -> Int - • In the expression: _ - In the expression: x `_` y + • In the expression: x `_` y In an equation for ‘g’: g x y = x `_` y • Relevant bindings include y :: Int (bound at T13050.hs:5:5) @@ -174,8 +173,7 @@ T13050.hs:5:11: warning: [-Wtyped-holes (in -Wdefault)] T13050.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _a :: Int -> Int -> Int Or perhaps ‘_a’ is mis-spelled, or not in scope - • In the expression: _a - In the expression: x `_a` y + • In the expression: x `_a` y In an equation for ‘q’: q x y = x `_a` y • Relevant bindings include y :: Int (bound at T13050.hs:6:5) diff --git a/testsuite/tests/typecheck/should_compile/T14590.stderr b/testsuite/tests/typecheck/should_compile/T14590.stderr index 52ecc8335d..7ecfa761f1 100644 --- a/testsuite/tests/typecheck/should_compile/T14590.stderr +++ b/testsuite/tests/typecheck/should_compile/T14590.stderr @@ -1,9 +1,9 @@ T14590.hs:4:13: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: Int -> Int -> Int - • In the expression: _ - In the expression: x `_` + • In the expression: x `_` In the expression: (x `_`) y + In an equation for ‘f1’: f1 x y = (x `_`) y • Relevant bindings include y :: Int (bound at T14590.hs:4:6) x :: Int (bound at T14590.hs:4:4) @@ -89,9 +89,9 @@ T14590.hs:4:13: warning: [-Wtyped-holes (in -Wdefault)] T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _a :: Int -> Int -> Int Or perhaps ‘_a’ is mis-spelled, or not in scope - • In the expression: _a - In the expression: x `_a` + • In the expression: x `_a` In the expression: (x `_a`) y + In an equation for ‘f2’: f2 x y = (x `_a`) y • Relevant bindings include y :: Int (bound at T14590.hs:5:6) x :: Int (bound at T14590.hs:5:4) @@ -176,9 +176,9 @@ T14590.hs:5:13: warning: [-Wtyped-holes (in -Wdefault)] T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: Int -> Int -> Int - • In the expression: _ - In the expression: `_` x + • In the expression: `_` x In the expression: (`_` x) y + In an equation for ‘f3’: f3 x y = (`_` x) y • Relevant bindings include y :: Int (bound at T14590.hs:6:6) x :: Int (bound at T14590.hs:6:4) @@ -264,9 +264,9 @@ T14590.hs:6:11: warning: [-Wtyped-holes (in -Wdefault)] T14590.hs:7:11: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _a :: Int -> Int -> Int Or perhaps ‘_a’ is mis-spelled, or not in scope - • In the expression: _a - In the expression: `_a` x + • In the expression: `_a` x In the expression: (`_a` x) y + In an equation for ‘f4’: f4 x y = (`_a` x) y • Relevant bindings include y :: Int (bound at T14590.hs:7:6) x :: Int (bound at T14590.hs:7:4) diff --git a/testsuite/tests/typecheck/should_compile/T18005.hs b/testsuite/tests/typecheck/should_compile/T18005.hs index 9b4ddbd366..8cd818bc0f 100644 --- a/testsuite/tests/typecheck/should_compile/T18005.hs +++ b/testsuite/tests/typecheck/should_compile/T18005.hs @@ -28,3 +28,4 @@ unT2b' (MkT2b x) = x pattern MkT2b' :: S2 -> T2b pattern MkT2b' {unT2b} <- (unT2b' -> unT2b) + diff --git a/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr b/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr index 18c45a12c0..71e175ef41 100644 --- a/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr +++ b/testsuite/tests/typecheck/should_fail/CustomTypeErrors01.stderr @@ -1,5 +1,5 @@ -CustomTypeErrors01.hs:12:9: error: +CustomTypeErrors01.hs:12:11: error: • Values of type 'MyType' cannot be compared for equality. • In the expression: x == MyType In an equation for ‘err’: err x = x == MyType diff --git a/testsuite/tests/typecheck/should_fail/T11274.stderr b/testsuite/tests/typecheck/should_fail/T11274.stderr index b6f1964c14..f73131704a 100644 --- a/testsuite/tests/typecheck/should_fail/T11274.stderr +++ b/testsuite/tests/typecheck/should_fail/T11274.stderr @@ -1,5 +1,5 @@ -T11274.hs:10:23: error: +T11274.hs:10:25: error: • No instance for (Eq Asd) arising from a use of ‘==’ • In the expression: x == y In an equation for ‘missingInstance’: missingInstance x y = x == y diff --git a/testsuite/tests/typecheck/should_fail/T12785b.stderr b/testsuite/tests/typecheck/should_fail/T12785b.stderr index 0a24b6ec6d..85d7361421 100644 --- a/testsuite/tests/typecheck/should_fail/T12785b.stderr +++ b/testsuite/tests/typecheck/should_fail/T12785b.stderr @@ -1,5 +1,5 @@ -T12785b.hs:29:63: error: +T12785b.hs:29:65: error: • Could not deduce: Payload ('S n) (Payload n s1) ~ s arising from a use of ‘SBranchX’ from the context: m ~ 'S n diff --git a/testsuite/tests/typecheck/should_fail/T13902.stderr b/testsuite/tests/typecheck/should_fail/T13902.stderr index 2794ae25ec..c7630039aa 100644 --- a/testsuite/tests/typecheck/should_fail/T13902.stderr +++ b/testsuite/tests/typecheck/should_fail/T13902.stderr @@ -1,7 +1,7 @@ T13902.hs:8:5: error: • Couldn't match expected type ‘t0 -> Int’ with actual type ‘Int’ - • The expression ‘f @Int’ is applied to two arguments, - but its type ‘Int -> Int’ has only one + • The function ‘f’ is applied to two value arguments, + but its type ‘Int -> Int’ has only one In the expression: f @Int 42 5 In an equation for ‘g’: g = f @Int 42 5 diff --git a/testsuite/tests/typecheck/should_fail/T17173.hs b/testsuite/tests/typecheck/should_fail/T17173.hs new file mode 100644 index 0000000000..d26c5dd619 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17173.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE RankNTypes, TypeApplications #-} + +module T17173 where + +-- This now fails with eager instantation +foo = (let myId :: forall a. a -> a; myId x = x in myId) @Bool True diff --git a/testsuite/tests/typecheck/should_fail/T17173.stderr b/testsuite/tests/typecheck/should_fail/T17173.stderr new file mode 100644 index 0000000000..b5bd059bac --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17173.stderr @@ -0,0 +1,17 @@ + +T17173.hs:6:7: error: + • Cannot apply expression of type ‘a0 -> a0’ + to a visible type argument ‘Bool’ + • In the expression: + (let + myId :: forall a. a -> a + myId x = x + in myId) + @Bool True + In an equation for ‘foo’: + foo + = (let + myId :: forall a. a -> a + myId x = x + in myId) + @Bool True diff --git a/testsuite/tests/typecheck/should_fail/T3176.stderr b/testsuite/tests/typecheck/should_fail/T3176.stderr index 50e6b52c78..1f089da6fe 100644 --- a/testsuite/tests/typecheck/should_fail/T3176.stderr +++ b/testsuite/tests/typecheck/should_fail/T3176.stderr @@ -1,7 +1,7 @@ -T3176.hs:9:27: - Cannot use record selector ‘unES’ as a function due to escaped type variables - Probable fix: use pattern-matching syntax instead - In the expression: unES - In the second argument of ‘($)’, namely ‘unES $ f t’ - In the expression: show $ unES $ f t +T3176.hs:9:27: error: + • Cannot use record selector ‘unES’ as a function due to escaped type variables + Probable fix: use pattern-matching syntax instead + • In the first argument of ‘($)’, namely ‘unES’ + In the second argument of ‘($)’, namely ‘unES $ f t’ + In the expression: show $ unES $ f t diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr index ccf791dd47..4f0e6ad3b2 100644 --- a/testsuite/tests/typecheck/should_fail/T5095.stderr +++ b/testsuite/tests/typecheck/should_fail/T5095.stderr @@ -1,13 +1,13 @@ -T5095.hs:9:9: error: +T5095.hs:9:11: error: • Overlapping instances for Eq a arising from a use of ‘==’ Matching instances: instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31 instance Eq Ordering -- Defined in ‘GHC.Classes’ instance Eq Integer - -- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’ + -- Defined in ‘integer-gmp-1.0.3.0:GHC.Integer.Type’ ...plus 23 others - ...plus N instances involving out-of-scope types + ...plus 7 instances involving out-of-scope types (use -fprint-potential-instances to see them all) (The choice depends on the instantiation of ‘a’ To pick the first instance above, use IncoherentInstances diff --git a/testsuite/tests/typecheck/should_fail/T5853.stderr b/testsuite/tests/typecheck/should_fail/T5853.stderr index 573a532f10..6fd62bb79b 100644 --- a/testsuite/tests/typecheck/should_fail/T5853.stderr +++ b/testsuite/tests/typecheck/should_fail/T5853.stderr @@ -1,5 +1,5 @@ -T5853.hs:15:46: error: +T5853.hs:15:52: error: • Could not deduce: Subst (Subst fa a) b ~ Subst fa b arising from a use of ‘<$>’ from the context: (F fa, Elem (Subst fa b) ~ b, diff --git a/testsuite/tests/typecheck/should_fail/T6069.stderr b/testsuite/tests/typecheck/should_fail/T6069.stderr index 3ee2b2d5e4..e2d3ef4d91 100644 --- a/testsuite/tests/typecheck/should_fail/T6069.stderr +++ b/testsuite/tests/typecheck/should_fail/T6069.stderr @@ -12,7 +12,7 @@ T6069.hs:14:15: error: Expected type: ST s1 Int -> a1 Actual type: (forall s. ST s a1) -> a1 • In the second argument of ‘(.)’, namely ‘runST’ - In the expression: print . runST + In the first argument of ‘($)’, namely ‘(print . runST)’ In the expression: (print . runST) $ fourty_two T6069.hs:15:16: error: diff --git a/testsuite/tests/typecheck/should_fail/T8603.stderr b/testsuite/tests/typecheck/should_fail/T8603.stderr index ec991bc39f..29c5d9df12 100644 --- a/testsuite/tests/typecheck/should_fail/T8603.stderr +++ b/testsuite/tests/typecheck/should_fail/T8603.stderr @@ -3,9 +3,9 @@ T8603.hs:33:17: error: • Couldn't match type ‘RV a1’ with ‘StateT s RV a0’ Expected type: [a2] -> StateT s RV a0 Actual type: t0 ((->) [a1]) (RV a1) - • The function ‘lift’ is applied to two arguments, - but its type ‘([a1] -> RV a1) -> t0 ((->) [a1]) (RV a1)’ - has only one + • The function ‘lift’ is applied to two value arguments, + but its type ‘([a1] -> RV a1) -> t0 ((->) [a1]) (RV a1)’ + has only one In a stmt of a 'do' block: prize <- lift uniform [1, 2, 3] In the expression: do prize <- lift uniform [1, 2, ....] diff --git a/testsuite/tests/typecheck/should_fail/T9605.stderr b/testsuite/tests/typecheck/should_fail/T9605.stderr index db65629fba..683265c26b 100644 --- a/testsuite/tests/typecheck/should_fail/T9605.stderr +++ b/testsuite/tests/typecheck/should_fail/T9605.stderr @@ -3,9 +3,7 @@ T9605.hs:7:6: error: • Couldn't match type ‘Bool’ with ‘m Bool’ Expected type: t0 -> m Bool Actual type: t0 -> Bool - • The function ‘f1’ is applied to one argument, - its type is ‘m0 Bool’, - it is specialized to ‘t0 -> Bool’ + • In the result of a function call In the expression: f1 undefined In an equation for ‘f2’: f2 = f1 undefined • Relevant bindings include f2 :: m Bool (bound at T9605.hs:7:1) diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr index 6d7e519d91..f4e1d02eee 100644 --- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr +++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr @@ -2,7 +2,8 @@ TcCoercibleFail.hs:11:8: error: • Couldn't match representation of type ‘Int’ with that of ‘()’ arising from a use of ‘coerce’ - • In the expression: coerce $ one :: () + • In the first argument of ‘($)’, namely ‘coerce’ + In the expression: coerce $ one :: () In an equation for ‘foo1’: foo1 = coerce $ one :: () TcCoercibleFail.hs:14:8: error: @@ -11,7 +12,8 @@ TcCoercibleFail.hs:14:8: error: arising from a use of ‘coerce’ NB: We cannot know what roles the parameters to ‘m’ have; we must assume that the role is nominal - • In the expression: coerce $ (return one :: m Int) + • In the first argument of ‘($)’, namely ‘coerce’ + In the expression: coerce $ (return one :: m Int) In an equation for ‘foo2’: foo2 = coerce $ (return one :: m Int) • Relevant bindings include foo2 :: m Age (bound at TcCoercibleFail.hs:14:1) @@ -19,7 +21,8 @@ TcCoercibleFail.hs:14:8: error: TcCoercibleFail.hs:16:8: error: • Couldn't match type ‘Int’ with ‘Age’ arising from a use of ‘coerce’ - • In the expression: coerce $ Map one () :: Map Age () + • In the first argument of ‘($)’, namely ‘coerce’ + In the expression: coerce $ Map one () :: Map Age () In an equation for ‘foo3’: foo3 = coerce $ Map one () :: Map Age () TcCoercibleFail.hs:18:8: error: @@ -28,7 +31,8 @@ TcCoercibleFail.hs:18:8: error: arising from a use of ‘coerce’ The data constructor ‘Data.Ord.Down’ of newtype ‘Down’ is not in scope - • In the expression: coerce $ one :: Down Int + • In the first argument of ‘($)’, namely ‘coerce’ + In the expression: coerce $ one :: Down Int In an equation for ‘foo4’: foo4 = coerce $ one :: Down Int TcCoercibleFail.hs:21:8: error: diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 14728794ce..5155e76a7b 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -562,3 +562,4 @@ test('T17773', normal, compile_fail, ['']) test('T17021', normal, compile_fail, ['']) test('T17021b', normal, compile_fail, ['']) test('T17955', normal, compile_fail, ['']) +test('T17173', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail001.stderr b/testsuite/tests/typecheck/should_fail/tcfail001.stderr index 56c28d98b5..2d4caf2ac7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail001.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail001.stderr @@ -2,7 +2,7 @@ tcfail001.hs:9:2: error: • Couldn't match expected type ‘[a]’ with actual type ‘[a0] -> [a1]’ - • The equation(s) for ‘op’ have one argument, - but its type ‘[a]’ has none + • The equation(s) for ‘op’ have one value argument, + but its type ‘[a]’ has none In the instance declaration for ‘A [a]’ • Relevant bindings include op :: [a] (bound at tcfail001.hs:9:2) diff --git a/testsuite/tests/typecheck/should_fail/tcfail007.stderr b/testsuite/tests/typecheck/should_fail/tcfail007.stderr index 4c1652fe50..02d25c16e3 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail007.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail007.stderr @@ -1,5 +1,5 @@ -tcfail007.hs:3:14: error: +tcfail007.hs:3:15: error: • No instance for (Num Bool) arising from a use of ‘+’ • In the expression: x + 1 In an equation for ‘n’: diff --git a/testsuite/tests/typecheck/should_fail/tcfail010.stderr b/testsuite/tests/typecheck/should_fail/tcfail010.stderr index 11e529084f..442a1d43a7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail010.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail010.stderr @@ -1,5 +1,5 @@ -tcfail010.hs:3:16: error: +tcfail010.hs:3:17: error: • No instance for (Num [a0]) arising from a use of ‘+’ • In the expression: z + 2 In the expression: \ (y : z) -> z + 2 diff --git a/testsuite/tests/typecheck/should_fail/tcfail029.stderr b/testsuite/tests/typecheck/should_fail/tcfail029.stderr index c31c5869b9..02adf4235d 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail029.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail029.stderr @@ -1,5 +1,5 @@ -tcfail029.hs:6:7: error: +tcfail029.hs:6:9: error: • No instance for (Ord Foo) arising from a use of ‘>’ • In the expression: x > Bar In an equation for ‘f’: f x = x > Bar diff --git a/testsuite/tests/typecheck/should_fail/tcfail034.stderr b/testsuite/tests/typecheck/should_fail/tcfail034.stderr index 9158fd2014..02e3bfc5f1 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail034.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail034.stderr @@ -1,5 +1,5 @@ -tcfail034.hs:17:11: error: +tcfail034.hs:17:13: error: • Could not deduce (Integral a) arising from a use of ‘mod’ from the context: (Num a, Eq a) bound by the type signature for: diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.hs b/testsuite/tests/typecheck/should_fail/tcfail133.hs index da58021700..f22feec9ae 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail133.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail133.hs @@ -73,7 +73,7 @@ foo = show $ add (One:@Zero) (One:@One) -- Add One One nr', AddDigit (Zero:@nr') One c, Show c -- -- ==> Add One One nr', AddDigit (Zero:@nr') One c, Show c --- +-- -- ==> Add One One (One:@One), AddDigit (Zero:@(One:@One)) One c, Show c -- -- ==> AddDigit (Zero:@(One:@One)) One c, Show c diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr index bbaf091226..9a70aedf5c 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr @@ -14,7 +14,8 @@ tcfail133.hs:68:7: error: ...plus 25 others ...plus 12 instances involving out-of-scope types (use -fprint-potential-instances to see them all) - • In the expression: show $ add (One :@ Zero) (One :@ One) + • In the first argument of ‘($)’, namely ‘show’ + In the expression: show $ add (One :@ Zero) (One :@ One) In an equation for ‘foo’: foo = show $ add (One :@ Zero) (One :@ One) diff --git a/testsuite/tests/typecheck/should_fail/tcfail140.stderr b/testsuite/tests/typecheck/should_fail/tcfail140.stderr index 924e14081b..c0049d0e19 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail140.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail140.stderr @@ -1,16 +1,16 @@ tcfail140.hs:10:7: error: • Couldn't match expected type ‘t0 -> t’ with actual type ‘Int’ - • The function ‘f’ is applied to two arguments, - but its type ‘Int -> Int’ has only one + • The function ‘f’ is applied to two value arguments, + but its type ‘Int -> Int’ has only one In the expression: f 3 9 In an equation for ‘bar’: bar = f 3 9 • Relevant bindings include bar :: t (bound at tcfail140.hs:10:1) tcfail140.hs:12:10: error: • Couldn't match expected type ‘t1 -> t’ with actual type ‘Int’ - • The operator ‘f’ takes two arguments, - but its type ‘Int -> Int’ has only one + • The operator ‘f’ takes two value arguments, + but its type ‘Int -> Int’ has only one In the expression: 3 `f` 4 In an equation for ‘rot’: rot xs = 3 `f` 4 • Relevant bindings include @@ -18,8 +18,8 @@ tcfail140.hs:12:10: error: tcfail140.hs:14:15: error: • Couldn't match expected type ‘t -> b’ with actual type ‘Int’ - • The operator ‘f’ takes two arguments, - but its type ‘Int -> Int’ has only one + • The operator ‘f’ takes two value arguments, + but its type ‘Int -> Int’ has only one In the first argument of ‘map’, namely ‘(3 `f`)’ In the expression: map (3 `f`) xs • Relevant bindings include @@ -29,11 +29,11 @@ tcfail140.hs:14:15: error: tcfail140.hs:16:8: error: • The constructor ‘Just’ should have 1 argument, but has been given none • In the pattern: Just - The lambda expression ‘\ Just x -> x’ has two arguments, - but its type ‘Maybe a -> a’ has only one + The lambda expression ‘\ Just x -> x’ has two value arguments, + but its type ‘Maybe a -> a’ has only one In the expression: (\ Just x -> x) :: Maybe a -> a tcfail140.hs:19:1: error: • Couldn't match expected type ‘Int’ with actual type ‘p0 -> Bool’ - • The equation(s) for ‘g’ have two arguments, - but its type ‘Int -> Int’ has only one + • The equation(s) for ‘g’ have two value arguments, + but its type ‘Int -> Int’ has only one diff --git a/testsuite/tests/typecheck/should_fail/tcfail143.stderr b/testsuite/tests/typecheck/should_fail/tcfail143.stderr index b94266978d..576ac1903d 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail143.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail143.stderr @@ -1,5 +1,5 @@ -tcfail143.hs:29:6: error: +tcfail143.hs:29:9: error: • Couldn't match type ‘S Z’ with ‘Z’ arising from a functional dependency between: constraint ‘MinMax (S Z) Z Z Z’ arising from a use of ‘extend’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail175.stderr b/testsuite/tests/typecheck/should_fail/tcfail175.stderr index 6fbb6d4cd6..90ec5b13a5 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail175.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail175.stderr @@ -6,7 +6,7 @@ tcfail175.hs:11:1: error: the type signature for: evalRHS :: forall a. Int -> a at tcfail175.hs:10:1-19 - • The equation(s) for ‘evalRHS’ have three arguments, - but its type ‘Int -> a’ has only one + • The equation(s) for ‘evalRHS’ have three value arguments, + but its type ‘Int -> a’ has only one • Relevant bindings include evalRHS :: Int -> a (bound at tcfail175.hs:11:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr index 9f5252539b..8a8263e8b4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr @@ -3,7 +3,7 @@ tcfail181.hs:17:9: error: • Could not deduce (Monad m0) arising from a use of ‘foo’ from the context: Monad m bound by the inferred type of - wog :: Monad m => p -> Something (m Bool) e + wog :: Monad m => p -> Something (m Bool) e at tcfail181.hs:17:1-30 The type variable ‘m0’ is ambiguous These potential instances exist: diff --git a/testsuite/tests/typecheck/should_fail/tcfail208.stderr b/testsuite/tests/typecheck/should_fail/tcfail208.stderr index cd8e6379e9..978200ad77 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail208.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail208.stderr @@ -1,5 +1,5 @@ -tcfail208.hs:4:10: error: +tcfail208.hs:4:19: error: • Could not deduce (Eq (m a)) arising from a use of ‘==’ from the context: (Monad m, Eq a) bound by the type signature for: diff --git a/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr b/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr index 532ca18ffc..6d02807207 100644 --- a/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr +++ b/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr @@ -55,8 +55,8 @@ CaretDiagnostics1.hs:13:7-11: error: CaretDiagnostics1.hs:(13,16)-(14,13): error: • Couldn't match expected type ‘Char -> p0’ with actual type ‘()’ - • The function ‘()’ is applied to one argument, - but its type ‘()’ has none + • The function ‘()’ is applied to one value argument, + but its type ‘()’ has none In the expression: () '0' In a case alternative: "γηξ" -> () '0' | |