mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
fix how free is called
somehow the previous version compiles passes llvm verification, but hangs when free is actually called
This commit is contained in:
parent
1b42831973
commit
1279999c6c
3 changed files with 10 additions and 35 deletions
|
@ -1920,36 +1920,4 @@ mod test_mono {
|
|||
),
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn linked_list_map() {
|
||||
compiles_to_ir(
|
||||
indoc!(
|
||||
r#"
|
||||
LinkedList a : [ Nil, Cons a (LinkedList a) ]
|
||||
|
||||
three : LinkedList Int
|
||||
three = Cons 3 (Cons 2 (Cons 1 Nil))
|
||||
|
||||
sum : LinkedList a -> Int
|
||||
sum = \list ->
|
||||
when list is
|
||||
Nil -> 0
|
||||
Cons x rest -> x + sum rest
|
||||
|
||||
map : (a -> b), LinkedList a -> LinkedList b
|
||||
map = \f, list ->
|
||||
when list is
|
||||
Nil -> Nil
|
||||
Cons x rest -> Cons (f x) (map f rest)
|
||||
|
||||
sum (map (\_ -> 1) three)
|
||||
"#
|
||||
),
|
||||
indoc!(
|
||||
r#"
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue