When applying a defaulting substitution, keep going even if value found.

Since our substitutions are idempotent, normally this would be just wasted
work, but when we are defaulting, we must make sure that we default the
varibales in the looked up thing also.

This fixes #534
This commit is contained in:
Iavor Diatchki 2018-07-23 03:30:52 -07:00
parent 863c165c66
commit f398a68fad

View File

@ -155,7 +155,7 @@ apSubstMaybe su ty =
applySubstToVar :: Subst -> TVar -> Maybe Type applySubstToVar :: Subst -> TVar -> Maybe Type
applySubstToVar su x = applySubstToVar su x =
case Map.lookup x (suMap su) of case Map.lookup x (suMap su) of
Just t -> Just t Just t -> Just (if suDefaulting su then apSubst su t else t)
Nothing Nothing
| suDefaulting su -> Just $! defaultFreeVar x | suDefaulting su -> Just $! defaultFreeVar x
| otherwise -> Nothing | otherwise -> Nothing