Sitelet https://github.com/starkware-libs/cairo/pull/10121/files
Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion crates/cairo-lang-semantic/src/items/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,7 @@ fn validate_impl_item_constant<'db>(

let expected_ty = inference.rewrite(concrete_trait_constant_ty).no_err();
let actual_ty = inference.rewrite(constant_ty).no_err();
if expected_ty != actual_ty {
if expected_ty != actual_ty && !expected_ty.is_missing(db) && !actual_ty.is_missing(db) {
diagnostics.report(
impl_constant_type_clause_ast.ty(db).stable_ptr(db),
WrongType { expected_ty, actual_ty },
Expand Down
29 changes: 29 additions & 0 deletions crates/cairo-lang-semantic/src/items/tests/trait_const
Original file line number Diff line number Diff line change
Expand Up @@ -844,3 +844,32 @@ impl SomeImpl of SomeTrait {
}

//! > expected_diagnostics

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

//! > Test impl const with an unresolvable type reports only the resolution error (no spurious

//! > type-mismatch cascade).

//! > test_runner_name
test_function_diagnostics(expect_diagnostics: true)

//! > function_code
fn foo() {}

//! > function_name
foo

//! > module_code
trait MyTrait {
const X: u32;
}
impl MyImpl of MyTrait {
const X: Nonexistent = 0;
}

//! > expected_diagnostics
error[E0006]: Type not found.
--> lib.cairo:5:14
const X: Nonexistent = 0;
^^^^^^^^^^^
Loading