mirror of
https://github.com/GaloisInc/cryptol.git
synced 2025-01-05 15:07:12 +03:00
Record the parameters of the current scheama into fresh variables generated during kind checking.
This commit is contained in:
parent
358d3fc554
commit
99c3547a08
@ -300,10 +300,18 @@ newGoalName = newName $ \s -> let x = seedGoal s
|
||||
|
||||
-- | Generate a new free type variable.
|
||||
newTVar :: Doc -> Kind -> InferM TVar
|
||||
newTVar src k =
|
||||
newTVar src k = newTVar' src Set.empty k
|
||||
|
||||
-- | Generate a new free type variable that depends on these additional
|
||||
-- type parameters.
|
||||
newTVar' :: Doc -> Set TVar -> Kind -> InferM TVar
|
||||
newTVar' src extraBound k =
|
||||
do bound <- getBoundInScope
|
||||
let vs = Set.union extraBound bound
|
||||
newName $ \s -> let x = seedTVar s
|
||||
in (TVFree x k bound src, s { seedTVar = x + 1 })
|
||||
in (TVFree x k vs src, s { seedTVar = x + 1 })
|
||||
|
||||
|
||||
|
||||
-- | Generate a new free type variable.
|
||||
newTParam :: Maybe QName -> Kind -> InferM TParam
|
||||
@ -613,7 +621,10 @@ kRecordWarning w = kInInferM $ recordWarning w
|
||||
|
||||
-- | Generate a fresh unification variable of the given kind.
|
||||
kNewType :: Doc -> Kind -> KindM Type
|
||||
kNewType src k = kInInferM $ newType src k
|
||||
kNewType src k =
|
||||
do tps <- KM $ do vs <- asks lazyTVars
|
||||
return $ Set.fromList [ tv | TVar tv <- Map.elems vs ]
|
||||
kInInferM $ TVar `fmap` newTVar' src tps k
|
||||
|
||||
-- | Lookup the definition of a type synonym.
|
||||
kLookupTSyn :: QName -> KindM (Maybe TySyn)
|
||||
|
Loading…
Reference in New Issue
Block a user