cairo-lang-lowering 2.17.0

Cairo lowering phase.
Documentation
//! > Literal value out of range.

//! > test_runner_name
test_function_lowering(expect_diagnostics: true)

//! > function_code
#[feature("bounded-int-utils")]
fn foo() {
    let _a: u8 = 0x100;
    let _a: u16 = 0x10000;
    let _a: u32 = 0x100000000;
    let _b: u64 = 0x10000000000000000;
    let _c: u128 = 0x100000000000000000000000000000000;
    let _d: felt252 = 0x800000000000011000000000000000000000000000000000000000000000001;
    let _e: NonZero<felt252> = 0;
    let _f: core::internal::bounded_int::BoundedInt<3, 15> = 2;
}

//! > function_name
foo

//! > lowering_diagnostics
error[E3009]: The value does not fit within the range of type core::integer::u8.
 --> lib.cairo:3:18
    let _a: u8 = 0x100;
                 ^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u16.
 --> lib.cairo:4:19
    let _a: u16 = 0x10000;
                  ^^^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u32.
 --> lib.cairo:5:19
    let _a: u32 = 0x100000000;
                  ^^^^^^^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u64.
 --> lib.cairo:6:19
    let _b: u64 = 0x10000000000000000;
                  ^^^^^^^^^^^^^^^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u128.
 --> lib.cairo:7:20
    let _c: u128 = 0x100000000000000000000000000000000;
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E3009]: The value does not fit within the range of type core::felt252.
 --> lib.cairo:8:23
    let _d: felt252 = 0x800000000000011000000000000000000000000000000000000000000000001;
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E3009]: The value does not fit within the range of type core::zeroable::NonZero::<core::felt252>.
 --> lib.cairo:9:32
    let _e: NonZero<felt252> = 0;
                               ^

error[E3009]: The value does not fit within the range of type core::internal::bounded_int::BoundedInt::<3, 15>.
 --> lib.cairo:10:62
    let _f: core::internal::bounded_int::BoundedInt<3, 15> = 2;
                                                             ^

//! > lowering_flat
<Failed lowering function - run with RUST_LOG=warn (or less) to see diagnostics>

//! > semantic_diagnostics

//! > ==========================================================================

//! > Literal short string out of range.

//! > test_runner_name
test_function_lowering(expect_diagnostics: true)

//! > function_code
fn foo() {
    let _a: u8 = 'aa';
    let _a: u16 = 'aba';
    let _b: u32 = 'abcda';
    let _b: u64 = 'abcdabcda';
    let _c: u128 = 'abcdabcdabcdabcda';
    let _d: felt252 = 'abcdabcdabcdabcdabcdabcdabcdabcd';
}

//! > function_name
foo

//! > lowering_diagnostics
error[E3009]: The value does not fit within the range of type core::integer::u8.
 --> lib.cairo:2:18
    let _a: u8 = 'aa';
                 ^^^^

error[E3009]: The value does not fit within the range of type core::integer::u16.
 --> lib.cairo:3:19
    let _a: u16 = 'aba';
                  ^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u32.
 --> lib.cairo:4:19
    let _b: u32 = 'abcda';
                  ^^^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u64.
 --> lib.cairo:5:19
    let _b: u64 = 'abcdabcda';
                  ^^^^^^^^^^^

error[E3009]: The value does not fit within the range of type core::integer::u128.
 --> lib.cairo:6:20
    let _c: u128 = 'abcdabcdabcdabcda';
                   ^^^^^^^^^^^^^^^^^^^

error[E3009]: The value does not fit within the range of type core::felt252.
 --> lib.cairo:7:23
    let _d: felt252 = 'abcdabcdabcdabcdabcdabcdabcdabcd';
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

//! > lowering_flat
<Failed lowering function - run with RUST_LOG=warn (or less) to see diagnostics>

//! > semantic_diagnostics

//! > ==========================================================================

//! > Literal values

//! > test_runner_name
test_function_lowering(expect_diagnostics: false)

//! > function_code
#[feature("bounded-int-utils")]
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

//! > 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)