failing test for #455

This commit is contained in:
Paul Chiusano 2019-04-11 16:34:51 -04:00
parent d46bb05f23
commit c0181c4158
2 changed files with 19 additions and 0 deletions

View File

@ -1058,6 +1058,7 @@ annotateLetRecBindings isTop letrec =
appendContext $ context (zipWith Ann vs bindingTypes)
-- check each `bi` against its type
Foldable.for_ (zip bindings bindingTypes) $ \(b, t) -> check b t
ensureGuardedCycle (vs `zip` bindings)
-- compute generalized types `gt1, gt2 ...` for each binding `b1, b2...`;
-- add annotations `v1 : gt1, v2 : gt2 ...` to the context
(_, _, ctx2) <- breakAt (Marker e1) <$> getContext
@ -1069,6 +1070,11 @@ annotateLetRecBindings isTop letrec =
appendContext . context $ marker : annotations
pure (marker, body, vs `zip` bindingTypesGeneralized)
ensureGuardedCycle :: [(v, Term v loc)] -> M v loc ()
ensureGuardedCycle _bindings = pure ()
-- todo: require that non-lambdas in the cycle may only depend on lambdas,
-- not on any other non-lambdas
existentialFunctionTypeFor :: (Var v) => Term v loc -> M v loc (Type v loc)
existentialFunctionTypeFor lam@(Term.LamNamed' v body) = do
v <- extendExistential v

View File

@ -0,0 +1,13 @@
x = y + 1
y = x + 1
> x
---
Currently crashes the runtime with a
unison: user error (type error, expecting N, got (UninitializedLetRecSlot x in [y,x]))