//! > Constants

//! > test_runner_name
test_function_lowering(expect_diagnostics: false)

//! > function_code
fn foo(x: felt252) -> felt252 {
    MY_CONST + x
}

//! > function_name
foo

//! > module_code
const MY_CONST: felt252 = 0x1234;

//! > semantic_diagnostics

//! > lowering_diagnostics

//! > lowering_flat
Parameters: v0: core::felt252
blk0 (root):
Statements:
  (v1: core::felt252) <- 4660
  (v2: core::felt252) <- core::felt252_add(v1, v0)
End:
  Return(v2)

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

//! > Complex constant

//! > test_runner_name
test_function_lowering(expect_diagnostics: false)

//! > function_code
fn foo() -> MyStruct {
    MY_CONST
}

//! > function_name
foo

//! > module_code
struct MyStruct {
    felt_val: felt252,
    bool_val: bool,
    my_enum_val1: MyEnum,
    my_enum_val2: MyEnum,
}

enum MyEnum {
    A: felt252,
    B,
}

const MY_CONST: MyStruct = MyStruct {
    felt_val: 1234, bool_val: true, my_enum_val1: MyEnum::A(5678), my_enum_val2: MyEnum::B,
};

//! > semantic_diagnostics

//! > lowering_diagnostics

//! > lowering_flat
Parameters:
blk0 (root):
Statements:
  (v0: test::MyStruct) <- { 1234: core::felt252, bool::True({}): core::bool, MyEnum::A(5678): test::MyEnum, MyEnum::B({}): test::MyEnum }
End:
  Return(v0)

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

//! > associated consts.

//! > test_runner_name
test_function_lowering(expect_diagnostics: false)

//! > function_code
fn foo() -> u32 {
    bar(S::<4> {})
}
fn bar<T, +MyTrait<T>, +Drop<T>>(x: T) -> u32 {
    MyTrait::<S<MyTrait::<T>::C>>::C
}

//! > function_name
foo

//! > module_code
struct S<const N: u32> {}
trait MyTrait<T> {
    const C: u32;
}
impl MyImpl<const N: u32> of MyTrait<S<N>> {
    const C: u32 = N;
}
impl SDrop<const N: u32> of Drop<S<N>> {}

//! > semantic_diagnostics

//! > lowering_diagnostics

//! > lowering_flat
Parameters:
blk0 (root):
Statements:
  (v0: core::integer::u32) <- 4
End:
  Return(v0)
