Do not replace already-recursive lambda sets in occurs checks

If a lambda set appears in an occurs chain but it is itself already
recursive, then it is should not be eligibil for modification in the
occurs chain.

Closes #4725
This commit is contained in:
Ayaz Hafiz 2023-04-12 16:13:30 -05:00
parent 191d8a7408
commit 87a36e62bf
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 26 additions and 1 deletions

View file

@ -3609,7 +3609,7 @@ fn check_for_infinite_type(
}
Content::LambdaSet(subs::LambdaSet {
solved,
recursion_var: _,
recursion_var: OptVariable::NONE,
unspecialized,
ambient_function: ambient_function_var,
}) => {

View file

@ -0,0 +1,25 @@
# +opt infer:print_only_under_alias
app "test" provides [main] to "./platform"
Effect : {} -> Str
after = \fx, toNext ->
afterInner = \{} ->
fxOut = fx {}
next = toNext fxOut
next {}
afterInner
await : Effect, (Str -> Effect) -> Effect
await = \fx, cont -> after fx (\result -> cont result)
line : Str -> Effect
line = \s -> \{} -> s
main =
#^^^^{-1} {} -[[afterInner(8) ({} -[[afterInner(8) ({} -a-> Str) (Str -[[13 (Str -[[20 Str]]-> ({} -[[16 Str]]-> Str))]]-> ({} -[[16 Str]]-> Str)), 16 Str] as a]-> Str) (Str -[[13 (Str -[[21]]-> ({} -[[16 Str]]-> Str))]]-> ({} -[[16 Str]]-> Str))] as [[afterInner(8) ({} -[[afterInner(8) ({} -a-> Str) (Str -[[13 (Str -[[20 Str]]-> ({} -[[16 Str]]-> Str))]]-> ({} -[[16 Str]]-> Str)), 16 Str] as a]-> Str) (Str -[[13 (Str -[[21]]-> ({} -[[16 Str]]-> Str))]]-> ({} -[[16 Str]]-> Str))] as b]]-> Str
await
(List.walk ["a", "b"] (line "printing letters") (\state, elem -> await state (\_ -> line elem)))
(\_ -> line "")