summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/specialise/SpecConstr.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs
index cb3830bb6b..b3adc36e02 100644
--- a/compiler/specialise/SpecConstr.hs
+++ b/compiler/specialise/SpecConstr.hs
@@ -37,7 +37,7 @@ import Type hiding ( substTy )
import TyCon ( isRecursiveTyCon, tyConName )
import Id
import PprCore ( pprParendExpr )
-import MkCore ( mkImpossibleExpr )
+import MkCore ( mkImpossibleExpr, sortQuantVars )
import Var
import VarEnv
import VarSet
@@ -1843,10 +1843,11 @@ callToPats env bndr_occs (Call _ args con_env)
-- See Note [Free type variables of the qvar types]
-- See Note [Shadowing] at the top
- (tvs, ids) = partition isTyVar qvars
- qvars' = tvs ++ map sanitise ids
- -- Put the type variables first; the type of a term
- -- variable may mention a type variable
+ (ktvs, ids) = partition isTyVar qvars
+ qvars' = sortQuantVars ktvs ++ map sanitise ids
+ -- Order into kind variables, type variables, term variables
+ -- The kind of a type variable may mention a kind variable
+ -- and the type of a term variable may mention a type variable
sanitise id = id `setIdType` expandTypeSynonyms (idType id)
-- See Note [Free type variables of the qvar types]