cairo-lang-semantic 2.18.0

Cairo semantic model.
Documentation
//! > Unknown return type

//! > test_runner_name
test_expr_diagnostics

//! > expr_code
{}

//! > module_code
fn foo1() -> UnknownType {
    0
}
fn foo2() -> UnknownType {
    return 0;
}
fn foo3() -> felt252 {
    UnknownType {}
}
fn foo4() -> felt252 {
    return UnknownType {};
}

//! > function_body

//! > expected_diagnostics
error[E0006]: Type not found.
 --> lib.cairo:1:14
fn foo1() -> UnknownType {
             ^^^^^^^^^^^

error[E0006]: Type not found.
 --> lib.cairo:4:14
fn foo2() -> UnknownType {
             ^^^^^^^^^^^

error[E0006]: Type not found.
 --> lib.cairo:8:5
    UnknownType {}
    ^^^^^^^^^^^

error[E0006]: Type not found.
 --> lib.cairo:11:12
    return UnknownType {};
           ^^^^^^^^^^^

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

//! > Unknown type in struct

//! > test_runner_name
test_expr_diagnostics

//! > expr_code
MyStruct{ a: 0 }

//! > module_code
struct MyStruct {
    a: UnknownType,
}

//! > function_body

//! > expected_diagnostics
error[E0006]: Type not found.
 --> lib.cairo:2:8
    a: UnknownType,
       ^^^^^^^^^^^

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

//! > Test missing path segment

//! > test_runner_name
test_expr_diagnostics

//! > expr_code
{
    let _x = a::;
}

//! > module_code
mod a {}

//! > function_body

//! > expected_diagnostics
error[E1003]: Missing tokens. Expected a path segment.
 --> lib.cairo:4:17
    let _x = a::;
                ^

error[E0006]: Identifier not found.
 --> lib.cairo:4:17
    let _x = a::;
                ^