Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test #7166

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions crates/cairo-lang-semantic/src/items/tests/trait_type
Original file line number Diff line number Diff line change
Expand Up @@ -3179,3 +3179,37 @@ error: Generic parameter trait of impl function `I::foo` is incompatible with `T
--> lib.cairo:9:12
fn foo<impl I1: MyTrait[ty: u64]>() {}
^^^^^^^^^^^^^^^^^^^^^^^^^

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

//! > Mismatch in associated type.

//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)

//! > function
fn foo() -> S<M> {
S { x: 3_felt252 }
}

//! > function_name
foo

//! > module_code
trait MyTrait {
type InputType;
}

impl M of MyTrait {
type InputType = u32;
}

struct S<impl M: MyTrait> {
x: M::InputType,
}

//! > expected_diagnostics
error: Unexpected return type. Expected: "test::S::<test::M>", found: "test::S::<test::M>".
--> lib.cairo:12:13
fn foo() -> S<M> {
^^^^
Loading