Merge remote-tracking branch 'origin/main' into save-construction-children

This commit is contained in:
J.Teeuwissen 2023-05-28 20:08:17 +02:00
commit 6e6e1ce833
No known key found for this signature in database
GPG key ID: DB5F7A1ED8D478AD
46 changed files with 890 additions and 214 deletions

View file

@ -3014,6 +3014,39 @@ fn rb_tree_fbip() {
)
}
#[mono_test]
fn specialize_after_match() {
indoc!(
r#"
app "test" provides [main] to "./platform"
main =
listA : LinkedList Str
listA = Nil
listB : LinkedList Str
listB = Nil
longestLinkedList listA listB
LinkedList a : [Cons a (LinkedList a), Nil]
longestLinkedList : LinkedList a, LinkedList a -> Nat
longestLinkedList = \listA, listB -> when listA is
Nil -> linkedListLength listB
Cons a aa -> when listB is
Nil -> linkedListLength listA
Cons b bb ->
lengthA = (linkedListLength aa) + 1
lengthB = linkedListLength listB
if lengthA > lengthB
then lengthA
else lengthB
linkedListLength : LinkedList a -> Nat
linkedListLength = \list -> when list is
Nil -> 0
Cons _ rest -> 1 + linkedListLength rest
"#
)
}
#[mono_test]
fn drop_specialize_after_struct() {
indoc!(