summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2020-04-08 23:08:12 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-22 23:13:06 -0400
commitffde234854f49dba9ec4735aad74b30fd2deee29 (patch)
tree80409f70e0de9164441d1cf860b386df4318e5c3 /testsuite/tests/ghci
parent34a45ee600d5346f5d1728047fa185698ed7ee84 (diff)
downloadhaskell-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/tests/ghci')
-rw-r--r--testsuite/tests/ghci/scripts/Defer02.stderr10
-rw-r--r--testsuite/tests/ghci/scripts/T10963.stderr21
-rw-r--r--testsuite/tests/ghci/scripts/ghci047.stderr6
3 files changed, 20 insertions, 17 deletions
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