//! > Test arm pattern destructure for match-enum param.
//! > test_runner_name
test_function_lowering
//! > function
fn foo(e: MyEnum) {
match e {
MyEnum::a((x, (y, z))) => {},
MyEnum::b((x, y)) => {},
MyEnum::c(x) => {},
MyEnum::d((x, y)) => {},
MyEnum::e(x) => {},
MyEnum::f((x,)) => {},
MyEnum::g(x) => {},
MyEnum::h(x) => {},
}
}
//! > function_name
foo
//! > module_code
enum MyEnum {
a: (felt252, (felt252, felt252)),
b: (felt252, (felt252, felt252)),
c: (felt252, (felt252, felt252)),
d: (felt252, felt252),
e: (felt252, felt252),
f: (felt252,),
g: (felt252,),
h: felt252
}
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters: v0: test::MyEnum
blk0 (root):
Statements:
End:
Match(match_enum(v0) {
MyEnum::a(v1) => blk1,
MyEnum::b(v6) => blk2,
MyEnum::c(v9) => blk3,
MyEnum::d(v10) => blk4,
MyEnum::e(v13) => blk5,
MyEnum::f(v14) => blk6,
MyEnum::g(v16) => blk7,
MyEnum::h(v17) => blk8,
})
blk1:
Statements:
End:
Goto(blk9, {})
blk2:
Statements:
End:
Goto(blk9, {})
blk3:
Statements:
End:
Goto(blk9, {})
blk4:
Statements:
End:
Goto(blk9, {})
blk5:
Statements:
End:
Goto(blk9, {})
blk6:
Statements:
End:
Goto(blk9, {})
blk7:
Statements:
End:
Goto(blk9, {})
blk8:
Statements:
End:
Goto(blk9, {})
blk9:
Statements:
(v18: ()) <- struct_construct()
End:
Return(v18)
//! > ==========================================================================
//! > Test arm pattern destructure for match-extern.
//! > test_runner_name
test_function_lowering
//! > function
fn foo(ref a: felt252) {
match bar(ref a) {
MyEnum::a((x, (y, z))) => {},
MyEnum::b((x, y)) => {},
MyEnum::c(x) => {},
MyEnum::d((x, y)) => {},
MyEnum::e(x) => {},
MyEnum::f((x,)) => {},
MyEnum::g(x) => {},
MyEnum::h(x) => {},
}
}
//! > function_name
foo
//! > module_code
enum MyEnum {
a: (felt252, (felt252, felt252)),
b: (felt252, (felt252, felt252)),
c: (felt252, (felt252, felt252)),
d: (felt252, felt252),
e: (felt252, felt252),
f: (felt252,),
g: (felt252,),
h: felt252
}
extern fn bar(ref a: felt252) -> MyEnum nopanic;
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters: v0: core::felt252
blk0 (root):
Statements:
End:
Match(match test::bar(v0) {
MyEnum::a(v1, v2, v3) => blk1,
MyEnum::b(v6, v7, v8) => blk2,
MyEnum::c(v9, v10, v11) => blk3,
MyEnum::d(v13, v14, v15) => blk4,
MyEnum::e(v16, v17, v18) => blk5,
MyEnum::f(v20, v21) => blk6,
MyEnum::g(v22, v23) => blk7,
MyEnum::h(v25, v26) => blk8,
})
blk1:
Statements:
End:
Goto(blk9, {v1 -> v27})
blk2:
Statements:
End:
Goto(blk9, {v6 -> v27})
blk3:
Statements:
End:
Goto(blk9, {v9 -> v27})
blk4:
Statements:
End:
Goto(blk9, {v13 -> v27})
blk5:
Statements:
End:
Goto(blk9, {v16 -> v27})
blk6:
Statements:
End:
Goto(blk9, {v20 -> v27})
blk7:
Statements:
End:
Goto(blk9, {v22 -> v27})
blk8:
Statements:
End:
Goto(blk9, {v25 -> v27})
blk9:
Statements:
(v28: ()) <- struct_construct()
End:
Return(v27, v28)
//! > ==========================================================================
//! > Test arm pattern destructure for match-enum variable.
//! > test_runner_name
test_function_lowering
//! > function
fn foo() {
let y = bar();
match y {
MyEnum::a((x, (y, z))) => {},
MyEnum::b((x, y)) => {},
MyEnum::c(x) => {},
MyEnum::d((x, y)) => {},
MyEnum::e(x) => {},
MyEnum::f((x,)) => {},
MyEnum::g(x) => {},
MyEnum::h(x) => {},
}
}
//! > function_name
foo
//! > module_code
enum MyEnum {
a: (felt252, (felt252, felt252)),
b: (felt252, (felt252, felt252)),
c: (felt252, (felt252, felt252)),
d: (felt252, felt252),
e: (felt252, felt252),
f: (felt252,),
g: (felt252,),
h: felt252
}
extern fn bar() -> MyEnum nopanic;
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters:
blk0 (root):
Statements:
End:
Match(match test::bar() {
MyEnum::a(v0, v1) => blk1,
MyEnum::b(v4, v5) => blk2,
MyEnum::c(v8, v9) => blk3,
MyEnum::d(v12, v13) => blk4,
MyEnum::e(v16, v17) => blk5,
MyEnum::f(v20) => blk6,
MyEnum::g(v23) => blk7,
MyEnum::h(v26) => blk8,
})
blk1:
Statements:
End:
Goto(blk9, {})
blk2:
Statements:
End:
Goto(blk9, {})
blk3:
Statements:
End:
Goto(blk9, {})
blk4:
Statements:
End:
Goto(blk9, {})
blk5:
Statements:
End:
Goto(blk9, {})
blk6:
Statements:
End:
Goto(blk9, {})
blk7:
Statements:
End:
Goto(blk9, {})
blk8:
Statements:
End:
Goto(blk9, {})
blk9:
Statements:
(v46: ()) <- struct_construct()
End:
Return(v46)
//! > ==========================================================================
//! > Test arm pattern destructure for match-extern (with refs and implicits).
//! > test_runner_name
test_function_lowering
//! > function
fn foo(mut z: felt252) {
match bar(ref z) {
MyEnum::a((x, (y, z))) => {},
MyEnum::b((x, y)) => {},
MyEnum::c(x) => {},
MyEnum::d((x, y)) => {},
MyEnum::e(x) => {},
MyEnum::f((x,)) => {},
MyEnum::g(x) => {},
MyEnum::h(x) => {},
}
}
//! > function_name
foo
//! > module_code
enum MyEnum {
a: (felt252, (felt252, felt252)),
b: (felt252, (felt252, felt252)),
c: (felt252, (felt252, felt252)),
d: (felt252, felt252),
e: (felt252, felt252),
f: (felt252,),
g: (felt252,),
h: felt252
}
extern fn bar(ref r: felt252) -> MyEnum implicits(RangeCheck) nopanic;
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters: v29: core::RangeCheck, v0: core::felt252
blk0 (root):
Statements:
End:
Match(match test::bar(v29, v0) {
MyEnum::a(v30, v1, v2, v3) => blk1,
MyEnum::b(v31, v6, v7, v8) => blk2,
MyEnum::c(v32, v9, v10, v11) => blk3,
MyEnum::d(v33, v13, v14, v15) => blk4,
MyEnum::e(v34, v16, v17, v18) => blk5,
MyEnum::f(v35, v20, v21) => blk6,
MyEnum::g(v36, v22, v23) => blk7,
MyEnum::h(v37, v25, v26) => blk8,
})
blk1:
Statements:
End:
Goto(blk9, {v30 -> v38})
blk2:
Statements:
End:
Goto(blk9, {v31 -> v38})
blk3:
Statements:
End:
Goto(blk9, {v32 -> v38})
blk4:
Statements:
End:
Goto(blk9, {v33 -> v38})
blk5:
Statements:
End:
Goto(blk9, {v34 -> v38})
blk6:
Statements:
End:
Goto(blk9, {v35 -> v38})
blk7:
Statements:
End:
Goto(blk9, {v36 -> v38})
blk8:
Statements:
End:
Goto(blk9, {v37 -> v38})
blk9:
Statements:
(v28: ()) <- struct_construct()
End:
Return(v38, v28)
//! > ==========================================================================
//! > Test arm pattern destructure for match-enum variable (with refs and implicits).
//! > test_runner_name
test_function_lowering
//! > function
fn foo(mut z: felt252) {
let y = bar(ref z);
match y {
MyEnum::a((x, (y, z))) => {},
MyEnum::b((x, y)) => {},
MyEnum::c(x) => {},
MyEnum::d((x, y)) => {},
MyEnum::e(x) => {},
MyEnum::f((x,)) => {},
MyEnum::g(x) => {},
MyEnum::h(x) => {},
}
}
//! > function_name
foo
//! > module_code
enum MyEnum {
a: (felt252, (felt252, felt252)),
b: (felt252, (felt252, felt252)),
c: (felt252, (felt252, felt252)),
d: (felt252, felt252),
e: (felt252, felt252),
f: (felt252,),
g: (felt252,),
h: felt252
}
extern fn bar(ref r: felt252) -> MyEnum implicits(RangeCheck) nopanic;
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters: v57: core::RangeCheck, v0: core::felt252
blk0 (root):
Statements:
End:
Match(match test::bar(v57, v0) {
MyEnum::a(v58, v1, v2, v3) => blk1,
MyEnum::b(v59, v6, v7, v8) => blk2,
MyEnum::c(v60, v11, v12, v13) => blk3,
MyEnum::d(v61, v16, v17, v18) => blk4,
MyEnum::e(v62, v21, v22, v23) => blk5,
MyEnum::f(v63, v26, v27) => blk6,
MyEnum::g(v64, v30, v31) => blk7,
MyEnum::h(v65, v34, v35) => blk8,
})
blk1:
Statements:
End:
Goto(blk9, {v58 -> v67})
blk2:
Statements:
End:
Goto(blk9, {v59 -> v67})
blk3:
Statements:
End:
Goto(blk9, {v60 -> v67})
blk4:
Statements:
End:
Goto(blk9, {v61 -> v67})
blk5:
Statements:
End:
Goto(blk9, {v62 -> v67})
blk6:
Statements:
End:
Goto(blk9, {v63 -> v67})
blk7:
Statements:
End:
Goto(blk9, {v64 -> v67})
blk8:
Statements:
End:
Goto(blk9, {v65 -> v67})
blk9:
Statements:
(v56: ()) <- struct_construct()
End:
Return(v67, v56)