Skip to content
Browse files

Add retract call in synthesizeClosed to make sure all recorded existe…

…ntials get noted
  • Loading branch information...
pchiusano committed Aug 1, 2018
1 parent 790646f commit f23ca960c8334d751064dab78c92933622afe126
Showing with 8 additions and 0 deletions.
  1. +8 −0 parser-typechecker/src/Unison/Typechecker/Context.hs
@@ -1094,8 +1094,16 @@ synthesizeClosed' :: (Var v, Ord loc)
-> Term v loc
-> M v loc (Type v loc)
synthesizeClosed' abilities term = do
-- save current context, for restoration when done
ctx0 <- getContext
setContext $ context []
v <- extendMarker $ Var.named "start"
t <- withEffects0 abilities (synthesize term)
ctx <- getContext
-- retract will cause notes to be written out for
-- any `Blank`-tagged existentials passing out of scope
doRetract (Marker v)
setContext ctx0 -- restore the initial context
pure $ generalizeExistentials ctx t

instance (Var v, Show loc) => Show (Element v loc) where

1 comment on commit f23ca96


This comment has been minimized.

Copy link
Member Author

pchiusano commented on f23ca96 Aug 1, 2018

@runarorama just calling your attention to this - now that doRetract looks for those recorded existentials passing out of scope so it can note their types, we want the main entry point to the typechecker to retract the whole context when it completes. The ensures any existentials we might have wanted to record are noted.

Please sign in to comment.
You can’t perform that action at this time.