@@ -1036,3 +1036,154 @@ test::foo@F0() -> (Box<NonZero<core::integer::u512>>);
10361036
10371037//! > function_costs
10381038test::foo: SmallOrderedMap({Const: 300})
1039+
1040+ //! > ==========================================================================
1041+
1042+ //! > const generator EcPoint.
1043+
1044+ //! > test_runner_name
1045+ WithOptsE2ETestRunner
1046+
1047+ //! > cairo_code
1048+ use core::ec::EcPoint;
1049+
1050+ mod value {
1051+ extern type Const<T, const X: felt252, const Y: felt252>;
1052+ }
1053+ extern fn const_as_box<T, const SEGMENT_INDEX: felt252>() -> Box<EcPoint> nopanic;
1054+
1055+ fn foo() -> Box<EcPoint> {
1056+ const_as_box::<
1057+ value::Const<
1058+ EcPoint,
1059+ 0x1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca,
1060+ 0x5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f,
1061+ >,
1062+ 0,
1063+ >()
1064+ }
1065+
1066+ //! > casm
1067+ call rel 5;
1068+ [ap + 0] = [ap + -1] + 4, ap++;
1069+ ret;
1070+ ret;
1071+ dw 874739451078007766457464989774322083649278607533249481151382481072868806602;
1072+ dw 152666792071518830868575557812948353041420400780739481342941381225525861407;
1073+
1074+ //! > sierra_code
1075+ type Box<EcPoint> = Box<EcPoint> [storable: true, drop: true, dup: true, zero_sized: false];
1076+ type Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407> = Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407> [storable: false, drop: false, dup: false, zero_sized: false];
1077+ type EcPoint = EcPoint [storable: true, drop: true, dup: true, zero_sized: false];
1078+
1079+ libfunc const_as_box<Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>, 0> = const_as_box<Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>, 0>;
1080+
1081+ F0:
1082+ const_as_box<Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>, 0>() -> ([0]);
1083+ return([0]);
1084+
1085+ test::foo@F0() -> (Box<EcPoint>);
1086+
1087+ //! > function_costs
1088+ test::foo: SmallOrderedMap({Const: 300})
1089+
1090+ //! > ==========================================================================
1091+
1092+ //! > const zero EcPoint.
1093+
1094+ //! > test_runner_name
1095+ WithOptsE2ETestRunner
1096+
1097+ //! > cairo_code
1098+ use core::ec::EcPoint;
1099+
1100+ mod value {
1101+ extern type Const<T, const X: felt252, const Y: felt252>;
1102+ }
1103+ extern fn const_as_box<T, const SEGMENT_INDEX: felt252>() -> Box<EcPoint> nopanic;
1104+
1105+ fn foo() -> Box<EcPoint> {
1106+ const_as_box::<value::Const<EcPoint, 0, 0>, 0>()
1107+ }
1108+
1109+ //! > casm
1110+ call rel 5;
1111+ [ap + 0] = [ap + -1] + 4, ap++;
1112+ ret;
1113+ ret;
1114+ dw 0;
1115+ dw 0;
1116+
1117+ //! > sierra_code
1118+ type Box<EcPoint> = Box<EcPoint> [storable: true, drop: true, dup: true, zero_sized: false];
1119+ type Const<EcPoint, 0, 0> = Const<EcPoint, 0, 0> [storable: false, drop: false, dup: false, zero_sized: false];
1120+ type EcPoint = EcPoint [storable: true, drop: true, dup: true, zero_sized: false];
1121+
1122+ libfunc const_as_box<Const<EcPoint, 0, 0>, 0> = const_as_box<Const<EcPoint, 0, 0>, 0>;
1123+
1124+ F0:
1125+ const_as_box<Const<EcPoint, 0, 0>, 0>() -> ([0]);
1126+ return([0]);
1127+
1128+ test::foo@F0() -> (Box<EcPoint>);
1129+
1130+ //! > function_costs
1131+ test::foo: SmallOrderedMap({Const: 300})
1132+
1133+ //! > ==========================================================================
1134+
1135+ //! > const non-zero generator EcPoint.
1136+
1137+ //! > test_runner_name
1138+ WithOptsE2ETestRunner
1139+
1140+ //! > cairo_code
1141+ use core::ec::EcPoint;
1142+
1143+ mod value {
1144+ extern type Const<T, const X: felt252, const Y: felt252>;
1145+ }
1146+ mod nz {
1147+ extern type Const<T, C>;
1148+ }
1149+ extern fn const_as_box<T, const SEGMENT_INDEX: felt252>() -> Box<NonZero<EcPoint>> nopanic;
1150+
1151+ fn foo() -> Box<NonZero<EcPoint>> {
1152+ const_as_box::<
1153+ nz::Const<
1154+ NonZero<EcPoint>,
1155+ value::Const<
1156+ EcPoint,
1157+ 0x1ef15c18599971b7beced415a40f0c7deacfd9b0d1819e03d723d8bc943cfca,
1158+ 0x5668060aa49730b7be4801df46ec62de53ecd11abe43a32873000c36e8dc1f,
1159+ >,
1160+ >,
1161+ 0,
1162+ >()
1163+ }
1164+
1165+ //! > casm
1166+ call rel 5;
1167+ [ap + 0] = [ap + -1] + 4, ap++;
1168+ ret;
1169+ ret;
1170+ dw 874739451078007766457464989774322083649278607533249481151382481072868806602;
1171+ dw 152666792071518830868575557812948353041420400780739481342941381225525861407;
1172+
1173+ //! > sierra_code
1174+ type Box<NonZero<EcPoint>> = Box<NonZero<EcPoint>> [storable: true, drop: true, dup: true, zero_sized: false];
1175+ type Const<NonZero<EcPoint>, Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>> = Const<NonZero<EcPoint>, Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>> [storable: false, drop: false, dup: false, zero_sized: false];
1176+ type EcPoint = EcPoint [storable: true, drop: true, dup: true, zero_sized: false];
1177+ type NonZero<EcPoint> = NonZero<EcPoint> [storable: true, drop: true, dup: true, zero_sized: false];
1178+ type Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407> = Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407> [storable: false, drop: false, dup: false, zero_sized: false];
1179+
1180+ libfunc const_as_box<Const<NonZero<EcPoint>, Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>>, 0> = const_as_box<Const<NonZero<EcPoint>, Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>>, 0>;
1181+
1182+ F0:
1183+ const_as_box<Const<NonZero<EcPoint>, Const<EcPoint, 874739451078007766457464989774322083649278607533249481151382481072868806602, 152666792071518830868575557812948353041420400780739481342941381225525861407>>, 0>() -> ([0]);
1184+ return([0]);
1185+
1186+ test::foo@F0() -> (Box<NonZero<EcPoint>>);
1187+
1188+ //! > function_costs
1189+ test::foo: SmallOrderedMap({Const: 300})
0 commit comments