mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Correctly instantiate recursion variables under nested aliases
Like we instantiate nested lambda set variables and nested OIOP variables for aliases, we need to do the same for recursion variables.
This commit is contained in:
parent
f2e12724d3
commit
f33651bf6a
4 changed files with 251 additions and 344 deletions
|
@ -1,6 +1,5 @@
|
|||
# +opt can:allow_errors
|
||||
# +opt infer:print_only_under_alias
|
||||
# +emit:mono
|
||||
app "test" provides [single] to "./platform"
|
||||
|
||||
LL a : [Nil, Cons a (LL a)]
|
||||
|
@ -9,7 +8,7 @@ LinkedList a : LL a
|
|||
|
||||
single : a -> LinkedList a
|
||||
single = \item -> (Cons item Nil)
|
||||
#^^^^^^{-1} a -[[single(0)]]-> [Cons a ([Cons elem b, Nil] as b), Nil]* as [Cons elem b, Nil] as b
|
||||
#^^^^^^{-1} a -[[single(0)]]-> [Cons a b, Nil]* as b
|
||||
|
||||
walk : LinkedList elem, state, (state, elem -> state) -> state
|
||||
walk = \list, state, fn ->
|
||||
|
@ -17,9 +16,3 @@ walk = \list, state, fn ->
|
|||
when list is
|
||||
Nil -> state
|
||||
Cons first rest -> walk (rest) (fn state first) fn
|
||||
|
||||
# -emit:mono
|
||||
procedure Test.0 (Test.6):
|
||||
let Test.15 : [<rnu><null>, C *self []] = TagId(1) ;
|
||||
let Test.14 : [<rnu><null>, C *self []] = TagId(0) Test.15 Test.6;
|
||||
ret Test.14;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue