mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-14 07:51:12 +03:00
failing test for #455
This commit is contained in:
parent
d46bb05f23
commit
c0181c4158
@ -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
|
||||
|
13
unison-src/errors/cyclic-unguarded.u
Normal file
13
unison-src/errors/cyclic-unguarded.u
Normal 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]))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user