Fixed two inference bugs
This commit is contained in:
parent
8b92dd9194
commit
a6ed6e589b
1 changed files with 5 additions and 5 deletions
|
|
@ -315,14 +315,14 @@ algoW = \case
|
||||||
EVar (LIdent i) -> do
|
EVar (LIdent i) -> do
|
||||||
var <- asks vars
|
var <- asks vars
|
||||||
case M.lookup (coerce i) var of
|
case M.lookup (coerce i) var of
|
||||||
Just t ->
|
Just t -> do
|
||||||
inst t >>= \x ->
|
t <- inst t
|
||||||
return (nullSubst, (T.EVar $ coerce i, x))
|
return (nullSubst, (T.EVar $ coerce i, t))
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
sig <- gets sigs
|
sig <- gets sigs
|
||||||
case M.lookup (coerce i) sig of
|
case M.lookup (coerce i) sig of
|
||||||
Just (Just t) -> do
|
Just (Just t) -> do
|
||||||
t <- freshen t
|
t <- inst t
|
||||||
return (nullSubst, (T.EVar $ coerce i, t))
|
return (nullSubst, (T.EVar $ coerce i, t))
|
||||||
Just Nothing -> do
|
Just Nothing -> do
|
||||||
fr <- fresh
|
fr <- fresh
|
||||||
|
|
@ -839,7 +839,7 @@ existInj :: (Monad m, MonadState Env m) => T.Ident -> m (Maybe Type)
|
||||||
existInj n = gets (M.lookup n . injections)
|
existInj n = gets (M.lookup n . injections)
|
||||||
|
|
||||||
flattenType :: Type -> [Type]
|
flattenType :: Type -> [Type]
|
||||||
flattenType (TFun a b) = flattenType a <> flattenType b
|
flattenType (TFun a b) = a : flattenType b
|
||||||
flattenType a = [a]
|
flattenType a = [a]
|
||||||
|
|
||||||
typeLength :: Type -> Int
|
typeLength :: Type -> Int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue