mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Put the capture niche in the lambda name instead of generating new names
This commit is contained in:
parent
1ed2e1a8e9
commit
019ebd93f7
20 changed files with 592 additions and 486 deletions
|
@ -1,24 +1,29 @@
|
|||
procedure #Multimorphic.0 (Test.23, #Attr.12):
|
||||
let Test.4 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
inc Test.4;
|
||||
dec #Attr.12;
|
||||
let Test.25 : Str = "";
|
||||
ret Test.25;
|
||||
procedure Num.94 (#Attr.2):
|
||||
let Num.273 : Str = lowlevel NumToStr #Attr.2;
|
||||
ret Num.273;
|
||||
|
||||
procedure #Multimorphic.1 (Test.17, #Attr.12):
|
||||
let Test.4 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
dec #Attr.12;
|
||||
let Test.19 : Str = "";
|
||||
ret Test.19;
|
||||
procedure Num.94 (#Attr.2):
|
||||
let Num.274 : Str = lowlevel NumToStr #Attr.2;
|
||||
ret Num.274;
|
||||
|
||||
procedure Test.1 (Test.4):
|
||||
let Test.16 : [C Str, C {}] = ClosureTag(#Multimorphic.1) Test.4;
|
||||
let Test.16 : [C U8, C U64] = ClosureTag(Test.5) Test.4;
|
||||
ret Test.16;
|
||||
|
||||
procedure Test.1 (Test.4):
|
||||
let Test.22 : [C Str, C {}] = ClosureTag(#Multimorphic.0) Test.4;
|
||||
let Test.22 : [C U8, C U64] = ClosureTag(Test.5) Test.4;
|
||||
ret Test.22;
|
||||
|
||||
procedure Test.5 (Test.17, #Attr.12):
|
||||
let Test.4 : U64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
let Test.19 : Str = CallByName Num.94 Test.4;
|
||||
ret Test.19;
|
||||
|
||||
procedure Test.5 (Test.17, #Attr.12):
|
||||
let Test.4 : U8 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
let Test.25 : Str = CallByName Num.94 Test.4;
|
||||
ret Test.25;
|
||||
|
||||
procedure Test.0 ():
|
||||
let Test.2 : Int1 = true;
|
||||
joinpoint Test.13 Test.3:
|
||||
|
@ -29,21 +34,21 @@ procedure Test.0 ():
|
|||
in
|
||||
switch Test.9:
|
||||
case 0:
|
||||
let Test.11 : Str = CallByName #Multimorphic.0 Test.8 Test.3;
|
||||
let Test.11 : Str = CallByName Test.5 Test.8 Test.3;
|
||||
jump Test.10 Test.11;
|
||||
|
||||
default:
|
||||
let Test.12 : Str = CallByName #Multimorphic.1 Test.8 Test.3;
|
||||
let Test.12 : Str = CallByName Test.5 Test.8 Test.3;
|
||||
jump Test.10 Test.12;
|
||||
|
||||
in
|
||||
let Test.26 : Int1 = true;
|
||||
let Test.27 : Int1 = lowlevel Eq Test.26 Test.2;
|
||||
if Test.27 then
|
||||
let Test.15 : {} = Struct {};
|
||||
let Test.14 : [C Str, C {}] = CallByName Test.1 Test.15;
|
||||
let Test.15 : U64 = 123i64;
|
||||
let Test.14 : [C U8, C U64] = CallByName Test.1 Test.15;
|
||||
jump Test.13 Test.14;
|
||||
else
|
||||
let Test.21 : Str = "";
|
||||
let Test.20 : [C Str, C {}] = CallByName Test.1 Test.21;
|
||||
let Test.21 : U8 = 18i64;
|
||||
let Test.20 : [C U8, C U64] = CallByName Test.1 Test.21;
|
||||
jump Test.13 Test.20;
|
||||
|
|
|
@ -1,24 +1,3 @@
|
|||
procedure #Multimorphic.0 (Test.29, #Attr.12):
|
||||
let Test.8 : {} = UnionAtIndex (Id 0) (Index 1) #Attr.12;
|
||||
let Test.7 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
let Test.49 : {} = Struct {};
|
||||
let Test.48 : Str = CallByName Test.16 Test.49;
|
||||
let Test.45 : {Str} = CallByName Test.4 Test.48;
|
||||
let Test.47 : {} = Struct {};
|
||||
let Test.46 : Str = CallByName Test.13 Test.47 Test.45;
|
||||
ret Test.46;
|
||||
|
||||
procedure #Multimorphic.1 (Test.29, #Attr.12):
|
||||
let Test.8 : {} = UnionAtIndex (Id 1) (Index 1) #Attr.12;
|
||||
let Test.7 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
let Test.35 : {} = Struct {};
|
||||
let Test.34 : Str = CallByName Test.15 Test.35;
|
||||
let Test.31 : {} = CallByName Test.3 Test.34;
|
||||
dec Test.34;
|
||||
let Test.33 : {} = Struct {};
|
||||
let Test.32 : Str = CallByName Test.11 Test.33;
|
||||
ret Test.32;
|
||||
|
||||
procedure Test.11 (Test.37):
|
||||
let Test.38 : Str = "";
|
||||
ret Test.38;
|
||||
|
@ -38,11 +17,11 @@ procedure Test.16 (Test.54):
|
|||
ret Test.56;
|
||||
|
||||
procedure Test.2 (Test.7, Test.8):
|
||||
let Test.9 : [C {} {}, C {} {}] = ClosureTag(#Multimorphic.0) Test.7 Test.8;
|
||||
let Test.9 : [C {} {}, C {} {}] = ClosureTag(Test.9) Test.7 Test.8;
|
||||
ret Test.9;
|
||||
|
||||
procedure Test.2 (Test.7, Test.8):
|
||||
let Test.9 : [C {} {}, C {} {}] = ClosureTag(#Multimorphic.1) Test.7 Test.8;
|
||||
let Test.9 : [C {} {}, C {} {}] = ClosureTag(Test.9) Test.7 Test.8;
|
||||
ret Test.9;
|
||||
|
||||
procedure Test.3 (Test.17):
|
||||
|
@ -53,6 +32,27 @@ procedure Test.4 (Test.18):
|
|||
let Test.50 : {Str} = Struct {Test.18};
|
||||
ret Test.50;
|
||||
|
||||
procedure Test.9 (Test.29, #Attr.12):
|
||||
let Test.8 : {} = UnionAtIndex (Id 0) (Index 1) #Attr.12;
|
||||
let Test.7 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
let Test.35 : {} = Struct {};
|
||||
let Test.34 : Str = CallByName Test.15 Test.35;
|
||||
let Test.31 : {} = CallByName Test.3 Test.34;
|
||||
dec Test.34;
|
||||
let Test.33 : {} = Struct {};
|
||||
let Test.32 : Str = CallByName Test.11 Test.33;
|
||||
ret Test.32;
|
||||
|
||||
procedure Test.9 (Test.29, #Attr.12):
|
||||
let Test.8 : {} = UnionAtIndex (Id 1) (Index 1) #Attr.12;
|
||||
let Test.7 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
let Test.49 : {} = Struct {};
|
||||
let Test.48 : Str = CallByName Test.16 Test.49;
|
||||
let Test.45 : {Str} = CallByName Test.4 Test.48;
|
||||
let Test.47 : {} = Struct {};
|
||||
let Test.46 : Str = CallByName Test.13 Test.47 Test.45;
|
||||
ret Test.46;
|
||||
|
||||
procedure Test.0 ():
|
||||
let Test.5 : Int1 = true;
|
||||
joinpoint Test.25 Test.6:
|
||||
|
@ -63,11 +63,11 @@ procedure Test.0 ():
|
|||
in
|
||||
switch Test.21:
|
||||
case 0:
|
||||
let Test.23 : Str = CallByName #Multimorphic.0 Test.20 Test.6;
|
||||
let Test.23 : Str = CallByName Test.9 Test.20 Test.6;
|
||||
jump Test.22 Test.23;
|
||||
|
||||
default:
|
||||
let Test.24 : Str = CallByName #Multimorphic.1 Test.20 Test.6;
|
||||
let Test.24 : Str = CallByName Test.9 Test.20 Test.6;
|
||||
jump Test.22 Test.24;
|
||||
|
||||
in
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
procedure #Multimorphic.0 (Test.28, #Attr.12):
|
||||
let Test.5 : U64 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
let Test.30 : Str = "";
|
||||
ret Test.30;
|
||||
|
||||
procedure #Multimorphic.1 (Test.20, #Attr.12):
|
||||
let Test.5 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
let Test.22 : Str = "";
|
||||
ret Test.22;
|
||||
|
||||
procedure Test.1 (Test.5):
|
||||
let Test.19 : [C U64, C {}, C ] = ClosureTag(#Multimorphic.1) Test.5;
|
||||
let Test.19 : [C , C U64, C {}] = ClosureTag(Test.6) Test.5;
|
||||
ret Test.19;
|
||||
|
||||
procedure Test.1 (Test.5):
|
||||
let Test.27 : [C U64, C {}, C ] = ClosureTag(#Multimorphic.0) Test.5;
|
||||
let Test.27 : [C , C U64, C {}] = ClosureTag(Test.6) Test.5;
|
||||
ret Test.27;
|
||||
|
||||
procedure Test.2 (Test.8):
|
||||
let Test.24 : Str = "";
|
||||
ret Test.24;
|
||||
|
||||
procedure Test.6 (Test.20, #Attr.12):
|
||||
let Test.5 : U64 = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
let Test.30 : Str = "";
|
||||
ret Test.30;
|
||||
|
||||
procedure Test.6 (Test.20, #Attr.12):
|
||||
let Test.5 : {} = UnionAtIndex (Id 2) (Index 0) #Attr.12;
|
||||
let Test.22 : Str = "";
|
||||
ret Test.22;
|
||||
|
||||
procedure Test.0 ():
|
||||
let Test.3 : U8 = 0u8;
|
||||
joinpoint Test.16 Test.4:
|
||||
|
@ -30,30 +30,30 @@ procedure Test.0 ():
|
|||
in
|
||||
switch Test.11:
|
||||
case 0:
|
||||
let Test.13 : Str = CallByName #Multimorphic.0 Test.10 Test.4;
|
||||
let Test.13 : Str = CallByName Test.2 Test.10;
|
||||
jump Test.12 Test.13;
|
||||
|
||||
case 1:
|
||||
let Test.14 : Str = CallByName #Multimorphic.1 Test.10 Test.4;
|
||||
let Test.14 : Str = CallByName Test.6 Test.10 Test.4;
|
||||
jump Test.12 Test.14;
|
||||
|
||||
default:
|
||||
let Test.15 : Str = CallByName Test.2 Test.10;
|
||||
let Test.15 : Str = CallByName Test.6 Test.10 Test.4;
|
||||
jump Test.12 Test.15;
|
||||
|
||||
in
|
||||
switch Test.3:
|
||||
case 0:
|
||||
let Test.18 : {} = Struct {};
|
||||
let Test.17 : [C U64, C {}, C ] = CallByName Test.1 Test.18;
|
||||
let Test.17 : [C , C U64, C {}] = CallByName Test.1 Test.18;
|
||||
jump Test.16 Test.17;
|
||||
|
||||
case 1:
|
||||
let Test.2 : [C U64, C {}, C ] = ClosureTag(Test.2) ;
|
||||
let Test.2 : [C , C U64, C {}] = ClosureTag(Test.2) ;
|
||||
jump Test.16 Test.2;
|
||||
|
||||
default:
|
||||
let Test.26 : U64 = 1i64;
|
||||
let Test.25 : [C U64, C {}, C ] = CallByName Test.1 Test.26;
|
||||
let Test.25 : [C , C U64, C {}] = CallByName Test.1 Test.26;
|
||||
jump Test.16 Test.25;
|
||||
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
procedure #Multimorphic.0 (Test.33, #Attr.12):
|
||||
let Test.5 : U64 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
dec #Attr.12;
|
||||
let Test.35 : Str = "";
|
||||
ret Test.35;
|
||||
|
||||
procedure #Multimorphic.1 (Test.21, #Attr.12):
|
||||
let Test.5 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
dec #Attr.12;
|
||||
let Test.23 : Str = "";
|
||||
ret Test.23;
|
||||
|
||||
procedure Test.1 (Test.5):
|
||||
let Test.20 : [C U64, C {}, C Str] = ClosureTag(#Multimorphic.1) Test.5;
|
||||
let Test.20 : [C U64, C {}, C Str] = ClosureTag(Test.6) Test.5;
|
||||
ret Test.20;
|
||||
|
||||
procedure Test.1 (Test.5):
|
||||
let Test.32 : [C U64, C {}, C Str] = ClosureTag(#Multimorphic.0) Test.5;
|
||||
let Test.32 : [C U64, C {}, C Str] = ClosureTag(Test.6) Test.5;
|
||||
ret Test.32;
|
||||
|
||||
procedure Test.2 (Test.7):
|
||||
let Test.26 : [C U64, C {}, C Str] = ClosureTag(Test.8) Test.7;
|
||||
ret Test.26;
|
||||
|
||||
procedure Test.6 (Test.21, #Attr.12):
|
||||
let Test.5 : U64 = UnionAtIndex (Id 0) (Index 0) #Attr.12;
|
||||
dec #Attr.12;
|
||||
let Test.35 : Str = "";
|
||||
ret Test.35;
|
||||
|
||||
procedure Test.6 (Test.21, #Attr.12):
|
||||
let Test.5 : {} = UnionAtIndex (Id 1) (Index 0) #Attr.12;
|
||||
dec #Attr.12;
|
||||
let Test.23 : Str = "";
|
||||
ret Test.23;
|
||||
|
||||
procedure Test.8 (Test.27, #Attr.12):
|
||||
let Test.7 : Str = UnionAtIndex (Id 2) (Index 0) #Attr.12;
|
||||
inc Test.7;
|
||||
|
@ -38,11 +38,11 @@ procedure Test.0 ():
|
|||
in
|
||||
switch Test.12:
|
||||
case 0:
|
||||
let Test.14 : Str = CallByName #Multimorphic.0 Test.11 Test.4;
|
||||
let Test.14 : Str = CallByName Test.6 Test.11 Test.4;
|
||||
jump Test.13 Test.14;
|
||||
|
||||
case 1:
|
||||
let Test.15 : Str = CallByName #Multimorphic.1 Test.11 Test.4;
|
||||
let Test.15 : Str = CallByName Test.6 Test.11 Test.4;
|
||||
jump Test.13 Test.15;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1530,19 +1530,18 @@ fn tail_call_with_different_layout() {
|
|||
fn multimorphic_lambda_set_capture() {
|
||||
indoc!(
|
||||
r#"
|
||||
capture : a -> ({} -> Str)
|
||||
capture : _ -> ({} -> Str)
|
||||
capture = \val ->
|
||||
\{} ->
|
||||
when val is
|
||||
_ -> ""
|
||||
Num.toStr val
|
||||
|
||||
x : [True, False]
|
||||
x = True
|
||||
|
||||
fun =
|
||||
when x is
|
||||
True -> capture {}
|
||||
False -> capture ""
|
||||
True -> capture 123u64
|
||||
False -> capture 18u8
|
||||
|
||||
fun {}
|
||||
"#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue