Compile lambdas that have an empty lambda set

Closes #3224

This should also fix a number of other issues often observed when a
lambda is never actually called, but we fail to codegen because it has
an empty lambda set.
This commit is contained in:
ayazhafiz 2022-07-05 23:35:41 -04:00 committed by Ayaz Hafiz
parent 7365da6f69
commit 937b73b797
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
6 changed files with 89 additions and 14 deletions

View file

@ -0,0 +1,18 @@
procedure List.5 (#Attr.2, #Attr.3):
let List.279 : List {} = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3;
decref #Attr.2;
ret List.279;
procedure Test.2 (Test.3):
let Test.7 : {} = Struct {};
let Test.6 : {} = CallByName Test.8 Test.7;
ret Test.6;
procedure Test.8 (Test.9, #Attr.12):
Error The `#UserApp.IdentId(8)` function could not be generated, likely due to a type error.
procedure Test.0 ():
let Test.1 : List {} = Array [];
let Test.5 : {} = Struct {};
let Test.4 : List {} = CallByName List.5 Test.1 Test.5;
ret Test.4;

View file

@ -1682,3 +1682,14 @@ fn choose_u128_layout() {
"#
)
}
#[mono_test]
fn call_function_in_empty_list() {
indoc!(
r#"
lst : List ({} -> {})
lst = []
List.map lst \f -> f {}
"#
)
}