Skip to content
Snippets Groups Projects
Commit 2be99d23 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

In TcValidity.checkAmbiguity, skolemise kind vars that appear free in the kinds of type variables

This was shown up by Trac #9222.
parent 0451f913
No related branches found
No related tags found
No related merge requests found
...@@ -74,11 +74,16 @@ checkAmbiguity ctxt ty ...@@ -74,11 +74,16 @@ checkAmbiguity ctxt ty
| otherwise | otherwise
= do { traceTc "Ambiguity check for" (ppr ty) = do { traceTc "Ambiguity check for" (ppr ty)
; (subst, _tvs) <- tcInstSkolTyVars (varSetElems (tyVarsOfType ty)) ; let free_tkvs = varSetElemsKvsFirst (closeOverKinds (tyVarsOfType ty))
; (subst, _tvs) <- tcInstSkolTyVars free_tkvs
; let ty' = substTy subst ty ; let ty' = substTy subst ty
-- The type might have free TyVars, -- The type might have free TyVars, esp when the ambiguity check
-- so we skolemise them as TcTyVars -- happens during a call to checkValidType,
-- so we skolemise them as TcTyVars.
-- Tiresome; but the type inference engine expects TcTyVars -- Tiresome; but the type inference engine expects TcTyVars
-- NB: The free tyvar might be (a::k), so k is also free
-- and we must skolemise it as well. Hence closeOverKinds.
-- (Trac #9222)
-- Solve the constraints eagerly because an ambiguous type -- Solve the constraints eagerly because an ambiguous type
-- can cause a cascade of further errors. Since the free -- can cause a cascade of further errors. Since the free
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment