summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-03-10 11:20:00 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-03-10 16:04:39 +0000
commit7e96526ac2ef5987ecb03217d3d616b6281c1441 (patch)
treeed201840c894bcb71f8811e839fedc82308cfaf7 /testsuite/tests/gadt
parentbc0f3abd0914808e33f84229818ab90842611bdd (diff)
downloadhaskell-7e96526ac2ef5987ecb03217d3d616b6281c1441.tar.gz
Fix TcSimplify.decideQuantification for kind variables
TcSimplify.decideQuantification was doing the Wrong Thing when "growing" the type variables to quantify over. We were trying to do this on a tyvar set where we'd split off the dependent type varaibles; and we just got it wrong. A kind variable wasn't being generalised properly, with confusing knock on consequences. All this led to Trac #13371 and Trac #13393. This commit tidies it all up: * The type TcDepVars is renamed as CandidateQTvs; and splitDepVarsOfType to candidateQTyVarsOfType * The code in TcSimplify.decideQuantification is simpler. It no longer does the tricky "grow" stuff over TcDepVars. Instead it use ordinary VarSets (thereby eliminating the nasty growThetaTyVarsDSet) and uses that to filter the result of candidateQTyVarsOfType. * I documented that candidateQTyVarsOfType returns the type variables in a good order in which to quantify, and rewrote it to use an accumulator pattern, so that we would predicatably get left-to-right ordering. In doing all this I also made UniqDFM behave a little more nicely: * When inserting an element that is there already, keep the old tag, while still overwriting with the new value. * This means that when doing udfmToList we get back elements in the order they were originally inserted, rather than in reverse order. It's not a big deal, but in a subsequent commit I use it to improve the order of type variables in inferred types. All this led to a lot of error message wibbles: - changing the order of quantified variables - changing the order in which instances are listed in GHCi - changing the tidying of variables in typechecker erors There's a submodule update for 'array' because one of its tests has an error-message change. I may not have associated all of them with the correct commit.
Diffstat (limited to 'testsuite/tests/gadt')
-rw-r--r--testsuite/tests/gadt/gadt7.stderr16
1 files changed, 8 insertions, 8 deletions
diff --git a/testsuite/tests/gadt/gadt7.stderr b/testsuite/tests/gadt/gadt7.stderr
index 7678a6ab07..ea9033ac6c 100644
--- a/testsuite/tests/gadt/gadt7.stderr
+++ b/testsuite/tests/gadt/gadt7.stderr
@@ -1,20 +1,20 @@
gadt7.hs:16:38: error:
- • Couldn't match expected type ‘p’ with actual type ‘p1’
- ‘p’ is untouchable
+ • Couldn't match expected type ‘p1’ with actual type ‘p’
+ ‘p1’ is untouchable
inside the constraints: a ~ Int
bound by a pattern with constructor: K :: T Int,
in a case alternative
at gadt7.hs:16:33
- ‘p’ is a rigid type variable bound by
- the inferred type of i1b :: T a -> p1 -> p at gadt7.hs:16:1-44
‘p1’ is a rigid type variable bound by
- the inferred type of i1b :: T a -> p1 -> p at gadt7.hs:16:1-44
+ the inferred type of i1b :: T a -> p -> p1 at gadt7.hs:16:1-44
+ ‘p’ is a rigid type variable bound by
+ the inferred type of i1b :: T a -> p -> p1 at gadt7.hs:16:1-44
Possible fix: add a type signature for ‘i1b’
• In the expression: y1
In a case alternative: K -> y1
In the expression: case t1 of { K -> y1 }
• Relevant bindings include
- y1 :: p1 (bound at gadt7.hs:16:16)
- y :: p1 (bound at gadt7.hs:16:7)
- i1b :: T a -> p1 -> p (bound at gadt7.hs:16:1)
+ y1 :: p (bound at gadt7.hs:16:16)
+ y :: p (bound at gadt7.hs:16:7)
+ i1b :: T a -> p -> p1 (bound at gadt7.hs:16:1)