summaryrefslogtreecommitdiff
path: root/testsuite/tests/patsyn
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-06-11 23:49:27 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-06-13 10:57:03 +0100
commit15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 (patch)
treee2e7336c63e9b7130ba70f3551ff290d4a25184b /testsuite/tests/patsyn
parentd25cb61a1c2a135a2564143a332f8b2962f134bc (diff)
downloadhaskell-15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72.tar.gz
Improve typechecking of let-bindings
This major commit was initially triggered by #11339, but it spiraled into a major review of the way in which type signatures for bindings are handled, especially partial type signatures. On the way I fixed a number of other bugs, namely #12069 #12033 #11700 #11339 #11670 The main change is that I completely reorganised the way in which type signatures in bindings are handled. The new story is in TcSigs Note [Overview of type signatures]. Some specific: * Changes in the data types for signatures in TcRnTypes: TcIdSigInfo and new TcIdSigInst * New module TcSigs deals with typechecking type signatures and pragmas. It contains code mostly moved from TcBinds, which is already too big * HsTypes: I swapped the nesting of HsWildCardBndrs and HsImplicitBndsrs, so that the wildcards are on the oustide not the insidde in a LHsSigWcType. This is just a matter of convenient, nothing deep. There are a host of other changes as knock-on effects, and it all took FAR longer than I anticipated :-). But it is a significant improvement, I think. Lots of error messages changed slightly, some just variants but some modest improvements. New tests * typecheck/should_compile * SigTyVars: a scoped-tyvar test * ExPat, ExPatFail: existential pattern bindings * T12069 * T11700 * T11339 * partial-sigs/should_compile * T12033 * T11339a * T11670 One thing to check: * Small change to output from ghc-api/landmines. Need to check with Alan Zimmerman
Diffstat (limited to 'testsuite/tests/patsyn')
-rw-r--r--testsuite/tests/patsyn/should_fail/T11010.stderr28
-rw-r--r--testsuite/tests/patsyn/should_fail/T11039.stderr18
-rw-r--r--testsuite/tests/patsyn/should_fail/T11667.stderr82
3 files changed, 64 insertions, 64 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T11010.stderr b/testsuite/tests/patsyn/should_fail/T11010.stderr
index 47492cde3a..1bd83c83b4 100644
--- a/testsuite/tests/patsyn/should_fail/T11010.stderr
+++ b/testsuite/tests/patsyn/should_fail/T11010.stderr
@@ -1,14 +1,14 @@
-
-T11010.hs:9:36: error:
- • Couldn't match type ‘a1’ with ‘Int’
- ‘a1’ is a rigid type variable bound by
- a pattern with constructor:
- Fun :: forall b a. String -> (a -> b) -> Expr a -> Expr b,
- in a pattern synonym declaration
- at T11010.hs:9:26
- Expected type: a -> b
- Actual type: a1 -> b
- • In the declaration for pattern synonym ‘IntFun’
- • Relevant bindings include
- x :: Expr a1 (bound at T11010.hs:9:36)
- f :: a1 -> b (bound at T11010.hs:9:34)
+
+T11010.hs:9:36: error:
+ • Couldn't match type ‘a1’ with ‘Int’
+ ‘a1’ is a rigid type variable bound by
+ a pattern with constructor:
+ Fun :: forall b a. String -> (a -> b) -> Expr a -> Expr b,
+ in a pattern synonym declaration
+ at T11010.hs:9:26-36
+ Expected type: a -> b
+ Actual type: a1 -> b
+ • In the declaration for pattern synonym ‘IntFun’
+ • Relevant bindings include
+ x :: Expr a1 (bound at T11010.hs:9:36)
+ f :: a1 -> b (bound at T11010.hs:9:34)
diff --git a/testsuite/tests/patsyn/should_fail/T11039.stderr b/testsuite/tests/patsyn/should_fail/T11039.stderr
index 9b749d1758..15a56e01ac 100644
--- a/testsuite/tests/patsyn/should_fail/T11039.stderr
+++ b/testsuite/tests/patsyn/should_fail/T11039.stderr
@@ -1,9 +1,9 @@
-
-T11039.hs:8:15: error:
- • Couldn't match type ‘f’ with ‘A’
- ‘f’ is a rigid type variable bound by
- the signature for pattern synonym ‘Q’ at T11039.hs:7:14
- Expected type: f a
- Actual type: A a
- • In the pattern: A a
- In the declaration for pattern synonym ‘Q’
+
+T11039.hs:8:15: error:
+ • Couldn't match type ‘f’ with ‘A’
+ ‘f’ is a rigid type variable bound by
+ the signature for pattern synonym ‘Q’ at T11039.hs:7:14-38
+ Expected type: f a
+ Actual type: A a
+ • In the pattern: A a
+ In the declaration for pattern synonym ‘Q’
diff --git a/testsuite/tests/patsyn/should_fail/T11667.stderr b/testsuite/tests/patsyn/should_fail/T11667.stderr
index 44bf88ced9..0407d00d09 100644
--- a/testsuite/tests/patsyn/should_fail/T11667.stderr
+++ b/testsuite/tests/patsyn/should_fail/T11667.stderr
@@ -1,41 +1,41 @@
-
-T11667.hs:12:22: error:
- • Could not deduce (Num a) arising from the literal ‘42’
- from the context: Eq a
- bound by the signature for pattern synonym ‘Pat1’
- at T11667.hs:12:9-12
- Possible fix:
- add (Num a) to the "required" context of
- the signature for pattern synonym ‘Pat1’
- • In the pattern: 42
- In the pattern: Just 42
- In the declaration for pattern synonym ‘Pat1’
-
-T11667.hs:18:28: error:
- • Couldn't match type ‘b’ with ‘Bool’
- arising from the "provided" constraints claimed by
- the signature of ‘Pat2’
- ‘b’ is a rigid type variable bound by
- the signature for pattern synonym ‘Pat2’ at T11667.hs:17:17
- • In the declaration for pattern synonym ‘Pat2’
- • Relevant bindings include y :: b (bound at T11667.hs:18:21)
-
-T11667.hs:24:24: error:
- • No instance for (Show a)
- arising from the "provided" constraints claimed by
- the signature of ‘Pat3’
- In other words, a successful match on the pattern
- Just x
- does not provide the constraint (Show a)
- • In the declaration for pattern synonym ‘Pat3’
-
-T11667.hs:31:16: error:
- • Could not deduce (Num a) arising from a use of ‘MkS’
- from the context: (Eq a, Show a)
- bound by the signature for pattern synonym ‘Pat4’
- at T11667.hs:31:1-21
- Possible fix:
- add (Num a) to the "required" context of
- the signature for pattern synonym ‘Pat4’
- • In the expression: MkS 42
- In an equation for ‘Pat4’: Pat4 = MkS 42
+
+T11667.hs:12:22: error:
+ • Could not deduce (Num a) arising from the literal ‘42’
+ from the context: Eq a
+ bound by the signature for pattern synonym ‘Pat1’
+ at T11667.hs:12:9-12
+ Possible fix:
+ add (Num a) to the "required" context of
+ the signature for pattern synonym ‘Pat1’
+ • In the pattern: 42
+ In the pattern: Just 42
+ In the declaration for pattern synonym ‘Pat1’
+
+T11667.hs:18:28: error:
+ • Couldn't match type ‘b’ with ‘Bool’
+ arising from the "provided" constraints claimed by
+ the signature of ‘Pat2’
+ ‘b’ is a rigid type variable bound by
+ the signature for pattern synonym ‘Pat2’ at T11667.hs:17:17-50
+ • In the declaration for pattern synonym ‘Pat2’
+ • Relevant bindings include y :: b (bound at T11667.hs:18:21)
+
+T11667.hs:24:24: error:
+ • No instance for (Show a)
+ arising from the "provided" constraints claimed by
+ the signature of ‘Pat3’
+ In other words, a successful match on the pattern
+ Just x
+ does not provide the constraint (Show a)
+ • In the declaration for pattern synonym ‘Pat3’
+
+T11667.hs:31:16: error:
+ • Could not deduce (Num a) arising from a use of ‘MkS’
+ from the context: (Eq a, Show a)
+ bound by the signature for pattern synonym ‘Pat4’
+ at T11667.hs:31:1-21
+ Possible fix:
+ add (Num a) to the "required" context of
+ the signature for pattern synonym ‘Pat4’
+ • In the expression: MkS 42
+ In an equation for ‘Pat4’: Pat4 = MkS 42