diff --git a/parser-typechecker/src/Unison/Typechecker/Context.hs b/parser-typechecker/src/Unison/Typechecker/Context.hs index 45cee71b02..8f207354b5 100644 --- a/parser-typechecker/src/Unison/Typechecker/Context.hs +++ b/parser-typechecker/src/Unison/Typechecker/Context.hs @@ -105,6 +105,7 @@ import Unison.Typechecker.TypeLookup qualified as TL import Unison.Typechecker.TypeVar qualified as TypeVar import Unison.Var (Var) import Unison.Var qualified as Var +import qualified Unison.Debug as Debug type TypeVar v loc = TypeVar.TypeVar (B.Blank loc) v @@ -1922,6 +1923,8 @@ annotateLetRecBindings span isTop letrec = gen bindingType _arity = generalizeExistentials ctx2 bindingType bindingTypesGeneralized = zipWith gen bindingTypes bindingArities annotations = zipWith Ann vs bindingTypesGeneralized + -- for_ (zip3 vs bindings bindingTypesGeneralized) \(v, b, t) -> do + -- noteBinding v (loc b) (TypeVar.lowerType t) appendContext annotations pure (body, vs `zip` bindingTypesGeneralized) @@ -2460,7 +2463,7 @@ checkWanted want (Term.Lam' body) (Type.Arrow'' i es o) = do body <- pure $ ABT.bindInheritAnnotation body (Term.var () x) checkWithAbilities es body o pure want -checkWanted want (Term.Let1Top' top binding m) t = do +checkWanted want abt@(Term.Let1Top' top binding m) t = do (tbinding, wbinding) <- synthesizeBinding top binding want <- coalesceWanted wbinding want v <- ABT.freshen m freshenVar @@ -2469,14 +2472,15 @@ checkWanted want (Term.Let1Top' top binding m) t = do -- enforce that actions in a block have type () subtype tbinding (DDB.unitType (ABT.annotation binding)) extendContext (Ann v tbinding) + -- Need to somehow fix the annotation on these + Debug.debugM Debug.Temp "checkWanted" $ (v, binding) + noteBinding v (ABT.annotation abt) (TypeVar.lowerType tbinding) checkWanted want (ABT.bindInheritAnnotation m (Term.var () v)) t checkWanted want (Term.LetRecNamed' [] m) t = checkWanted want m t -- letrec can't have effects, so it doesn't extend the wanted set checkWanted want abt@(Term.LetRecTop' isTop lr) t = markThenRetractWanted (Var.named "let-rec-marker") $ do - -- TODO: I don't think we want to emit types for local bindings from here, but will need - -- to refactor to do that properly e <- annotateLetRecBindings (ABT.annotation abt) isTop lr checkWanted want e t checkWanted want e@(Term.Match' scrut cases) t = do