@@ -105,6 +105,7 @@ import Unison.Typechecker.TypeLookup qualified as TL
105
105
import Unison.Typechecker.TypeVar qualified as TypeVar
106
106
import Unison.Var (Var )
107
107
import Unison.Var qualified as Var
108
+ import qualified Unison.Debug as Debug
108
109
109
110
type TypeVar v loc = TypeVar. TypeVar (B. Blank loc ) v
110
111
@@ -1922,6 +1923,8 @@ annotateLetRecBindings span isTop letrec =
1922
1923
gen bindingType _arity = generalizeExistentials ctx2 bindingType
1923
1924
bindingTypesGeneralized = zipWith gen bindingTypes bindingArities
1924
1925
annotations = zipWith Ann vs bindingTypesGeneralized
1926
+ -- for_ (zip3 vs bindings bindingTypesGeneralized) \(v, b, t) -> do
1927
+ -- noteBinding v (loc b) (TypeVar.lowerType t)
1925
1928
appendContext annotations
1926
1929
pure (body, vs `zip` bindingTypesGeneralized)
1927
1930
@@ -2460,7 +2463,7 @@ checkWanted want (Term.Lam' body) (Type.Arrow'' i es o) = do
2460
2463
body <- pure $ ABT. bindInheritAnnotation body (Term. var () x)
2461
2464
checkWithAbilities es body o
2462
2465
pure want
2463
- checkWanted want (Term. Let1Top' top binding m) t = do
2466
+ checkWanted want abt @ (Term. Let1Top' top binding m) t = do
2464
2467
(tbinding, wbinding) <- synthesizeBinding top binding
2465
2468
want <- coalesceWanted wbinding want
2466
2469
v <- ABT. freshen m freshenVar
@@ -2469,14 +2472,15 @@ checkWanted want (Term.Let1Top' top binding m) t = do
2469
2472
-- enforce that actions in a block have type ()
2470
2473
subtype tbinding (DDB. unitType (ABT. annotation binding))
2471
2474
extendContext (Ann v tbinding)
2475
+ -- Need to somehow fix the annotation on these
2476
+ Debug. debugM Debug. Temp " checkWanted" $ (v, binding)
2477
+ noteBinding v (ABT. annotation abt) (TypeVar. lowerType tbinding)
2472
2478
checkWanted want (ABT. bindInheritAnnotation m (Term. var () v)) t
2473
2479
checkWanted want (Term. LetRecNamed' [] m) t =
2474
2480
checkWanted want m t
2475
2481
-- letrec can't have effects, so it doesn't extend the wanted set
2476
2482
checkWanted want abt@ (Term. LetRecTop' isTop lr) t =
2477
2483
markThenRetractWanted (Var. named " let-rec-marker" ) $ do
2478
- -- TODO: I don't think we want to emit types for local bindings from here, but will need
2479
- -- to refactor to do that properly
2480
2484
e <- annotateLetRecBindings (ABT. annotation abt) isTop lr
2481
2485
checkWanted want e t
2482
2486
checkWanted want e@ (Term. Match' scrut cases) t = do
0 commit comments