This commit is contained in:
Ayaz Hafiz 2022-12-13 11:17:23 -06:00
parent 6f2e14cf18
commit ed4e047ee8
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58
2 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,49 @@
procedure Bool.11 (#Attr.2, #Attr.3):
let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3;
ret Bool.23;
procedure Bool.2 ():
let Bool.24 : Int1 = true;
ret Bool.24;
procedure Num.19 (#Attr.2, #Attr.3):
let Num.256 : U64 = lowlevel NumAdd #Attr.2 #Attr.3;
ret Num.256;
procedure Num.21 (#Attr.2, #Attr.3):
let Num.257 : U64 = lowlevel NumMul #Attr.2 #Attr.3;
ret Num.257;
procedure Test.0 (Test.8):
let Test.23 : Int1 = CallByName Bool.2;
if Test.23 then
let Test.24 : {} = Struct {};
ret Test.24;
else
let Test.22 : {} = Struct {};
ret Test.22;
procedure Test.5 (Test.6, Test.2):
joinpoint Test.19 Test.18:
ret Test.18;
in
switch Test.2:
case 0:
let Test.20 : U64 = CallByName Num.19 Test.6 Test.6;
jump Test.19 Test.20;
default:
let Test.21 : U64 = CallByName Num.21 Test.6 Test.6;
jump Test.19 Test.21;
procedure Test.7 ():
let Test.13 : U64 = 3i64;
let Test.15 : {} = Struct {};
let Test.14 : Int1 = CallByName Test.0 Test.15;
let Test.11 : U64 = CallByName Test.5 Test.13 Test.14;
let Test.12 : U64 = 9i64;
let Test.10 : Int1 = CallByName Bool.11 Test.11 Test.12;
expect Test.10;
let Test.9 : {} = Struct {};
ret Test.9;

View File

@ -2173,3 +2173,22 @@ fn issue_4749() {
"###
)
}
#[mono_test(mode = "test", no_check)]
fn issue_4733() {
indoc!(
r###"
interface Test exposes [] imports []
fn = \{} ->
instr : [ Op (U64, U64 -> U64) ]
instr = if Bool.true then (Op Num.mul) else (Op Num.add)
Op op = instr
\a -> op a a
expect ((fn {}) 3) == 9
"###
)
}