//! > Literal value out of range.
//! > test_runner_name
test_function_lowering(expect_diagnostics: true)
//! > function
fn foo() {
let _a = 0x100_u8;
let _a = 0x10000_u16;
let _a = 0x100000000_u32;
let _b = 0x10000000000000000_u64;
let _c = 0x100000000000000000000000000000000_u128;
let _d = 0x800000000000011000000000000000000000000000000000000000000000001;
let _e: NonZero<felt252> = 0;
let _f: core::internal::bounded_int::BoundedInt<3, 15> = 2;
}
//! > function_name
foo
//! > module_code
//! > lowering_diagnostics
error: The value does not fit within the range of type core::integer::u8.
--> lib.cairo:2:14
let _a = 0x100_u8;
^******^
error: The value does not fit within the range of type core::integer::u16.
--> lib.cairo:3:14
let _a = 0x10000_u16;
^*********^
error: The value does not fit within the range of type core::integer::u32.
--> lib.cairo:4:14
let _a = 0x100000000_u32;
^*************^
error: The value does not fit within the range of type core::integer::u64.
--> lib.cairo:5:14
let _b = 0x10000000000000000_u64;
^*********************^
error: The value does not fit within the range of type core::integer::u128.
--> lib.cairo:6:14
let _c = 0x100000000000000000000000000000000_u128;
^**************************************^
error: The value does not fit within the range of type core::felt252.
--> lib.cairo:7:14
let _d = 0x800000000000011000000000000000000000000000000000000000000000001;
^***************************************************************^
error: The value does not fit within the range of type core::zeroable::NonZero::<core::felt252>.
--> lib.cairo:8:32
let _e: NonZero<felt252> = 0;
^
error: The value does not fit within the range of type core::internal::bounded_int::BoundedInt::<3, 15>.
--> lib.cairo:9:62
let _f: core::internal::bounded_int::BoundedInt<3, 15> = 2;
^
//! > lowering_flat
Parameters:
blk0 (root):
Statements:
End:
Return()
//! > semantic_diagnostics
//! > ==========================================================================
//! > Literal short string out of range.
//! > test_runner_name
test_function_lowering(expect_diagnostics: true)
//! > function
fn foo() {
let _a = 'aa'_u8;
let _a = 'aba'_u16;
let _b = 'abcda'_u32;
let _b = 'abcdabcda'_u64;
let _c = 'abcdabcdabcdabcda'_u128;
let _d = 'abcdabcdabcdabcdabcdabcdabcdabcd';
}
//! > function_name
foo
//! > module_code
//! > lowering_diagnostics
error: The value does not fit within the range of type core::integer::u8.
--> lib.cairo:2:14
let _a = 'aa'_u8;
^*****^
error: The value does not fit within the range of type core::integer::u16.
--> lib.cairo:3:14
let _a = 'aba'_u16;
^*******^
error: The value does not fit within the range of type core::integer::u32.
--> lib.cairo:4:14
let _b = 'abcda'_u32;
^*********^
error: The value does not fit within the range of type core::integer::u64.
--> lib.cairo:5:14
let _b = 'abcdabcda'_u64;
^*************^
error: The value does not fit within the range of type core::integer::u128.
--> lib.cairo:6:14
let _c = 'abcdabcdabcdabcda'_u128;
^**********************^
error: The value does not fit within the range of type core::felt252.
--> lib.cairo:7:14
let _d = 'abcdabcdabcdabcdabcdabcdabcdabcd';
^********************************^
//! > lowering_flat
Parameters:
blk0 (root):
Statements:
End:
Return()
//! > semantic_diagnostics
//! > ==========================================================================
//! > Literal values
//! > test_runner_name
test_function_lowering(expect_diagnostics: false)
//! > function
fn foo() -> (
felt252,
u8,
u16,
u32,
u64,
u128,
i8,
i16,
i32,
i64,
i128,
u256,
core::internal::bounded_int::BoundedInt<10, 100>,
) {
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
}
//! > function_name
foo
//! > module_code
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > lowering_flat
Parameters:
blk0 (root):
Statements:
(v0: core::felt252) <- 1
(v1: core::integer::u8) <- 2
(v2: core::integer::u16) <- 3
(v3: core::integer::u32) <- 4
(v4: core::integer::u64) <- 5
(v5: core::integer::u128) <- 6
(v6: core::integer::i8) <- 7
(v7: core::integer::i16) <- 8
(v8: core::integer::i32) <- 9
(v9: core::integer::i64) <- 10
(v10: core::integer::i128) <- 11
(v11: core::integer::u256) <- { 12: core::integer::u128, 0: core::integer::u128 }
(v12: core::internal::bounded_int::BoundedInt::<10, 100>) <- 13
(v13: (core::felt252, core::integer::u8, core::integer::u16, core::integer::u32, core::integer::u64, core::integer::u128, core::integer::i8, core::integer::i16, core::integer::i32, core::integer::i64, core::integer::i128, core::integer::u256, core::internal::bounded_int::BoundedInt::<10, 100>)) <- struct_construct(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12)
End:
Return(v13)