From 15b9bf4ba4ab47e6809bf2b3b36ec16e502aea72 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Sat, 11 Jun 2016 23:49:27 +0100 Subject: 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 --- testsuite/tests/arrows/should_fail/T5380.stderr | 64 ++++++++++++------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'testsuite/tests/arrows') diff --git a/testsuite/tests/arrows/should_fail/T5380.stderr b/testsuite/tests/arrows/should_fail/T5380.stderr index 0e258a2c28..6c7caf789d 100644 --- a/testsuite/tests/arrows/should_fail/T5380.stderr +++ b/testsuite/tests/arrows/should_fail/T5380.stderr @@ -1,32 +1,32 @@ - -T5380.hs:7:27: error: - • Couldn't match expected type ‘Bool’ with actual type ‘not_bool’ - ‘not_bool’ is a rigid type variable bound by - the type signature for: - testB :: forall not_bool not_unit. - not_bool -> (() -> ()) -> () -> not_unit - at T5380.hs:6:10 - • In the expression: b - In the expression: proc () -> if b then f -< () else f -< () - In an equation for ‘testB’: - testB b f = proc () -> if b then f -< () else f -< () - • Relevant bindings include - b :: not_bool (bound at T5380.hs:7:7) - testB :: not_bool -> (() -> ()) -> () -> not_unit - (bound at T5380.hs:7:1) - -T5380.hs:7:34: error: - • Couldn't match type ‘not_unit’ with ‘()’ - ‘not_unit’ is a rigid type variable bound by - the type signature for: - testB :: forall not_bool not_unit. - not_bool -> (() -> ()) -> () -> not_unit - at T5380.hs:6:10 - Expected type: () -> not_unit - Actual type: () -> () - • In the expression: f - In the command: f -< () - In the expression: proc () -> if b then f -< () else f -< () - • Relevant bindings include - testB :: not_bool -> (() -> ()) -> () -> not_unit - (bound at T5380.hs:7:1) + +T5380.hs:7:27: error: + • Couldn't match expected type ‘Bool’ with actual type ‘not_bool’ + ‘not_bool’ is a rigid type variable bound by + the type signature for: + testB :: forall not_bool not_unit. + not_bool -> (() -> ()) -> () -> not_unit + at T5380.hs:6:1-49 + • In the expression: b + In the expression: proc () -> if b then f -< () else f -< () + In an equation for ‘testB’: + testB b f = proc () -> if b then f -< () else f -< () + • Relevant bindings include + b :: not_bool (bound at T5380.hs:7:7) + testB :: not_bool -> (() -> ()) -> () -> not_unit + (bound at T5380.hs:7:1) + +T5380.hs:7:34: error: + • Couldn't match type ‘not_unit’ with ‘()’ + ‘not_unit’ is a rigid type variable bound by + the type signature for: + testB :: forall not_bool not_unit. + not_bool -> (() -> ()) -> () -> not_unit + at T5380.hs:6:1-49 + Expected type: () -> not_unit + Actual type: () -> () + • In the expression: f + In the command: f -< () + In the expression: proc () -> if b then f -< () else f -< () + • Relevant bindings include + testB :: not_bool -> (() -> ()) -> () -> not_unit + (bound at T5380.hs:7:1) -- cgit v1.2.1