Skip to content

Commit

Permalink
Don't report diagnostics for missing types.
Browse files Browse the repository at this point in the history
commit-id:e85f35c0
  • Loading branch information
liorgold2 committed Aug 24, 2024
1 parent 44627a3 commit 4d5db86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
20 changes: 0 additions & 20 deletions crates/cairo-lang-semantic/src/expr/test_data/impl
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,7 @@ error: Type not found.
fn foo(x: T, y: u8, z: u16) -> T {}
^

error: Parameter type of impl function `MyImpl::foo` is incompatible with `MyTrait::foo`. Expected: `core::integer::u8`, actual: `<missing>`.
--> lib.cairo:7:15
fn foo(x: T, y: u8, z: u16) -> T {}
^

error: Parameter type of impl function `MyImpl::foo` is incompatible with `MyTrait::foo`. Expected: `<missing>`, actual: `core::integer::u8`.
--> lib.cairo:7:21
fn foo(x: T, y: u8, z: u16) -> T {}
^^

error: Parameter type of impl function `MyImpl::foo` is incompatible with `MyTrait::foo`. Expected: `core::integer::u8`, actual: `core::integer::u16`.
--> lib.cairo:7:28
fn foo(x: T, y: u8, z: u16) -> T {}
^*^

error: Return type of impl function `MyImpl::foo` is incompatible with `MyTrait::foo`. Expected: `core::integer::u8`, actual: `<missing>`.
--> lib.cairo:7:36
fn foo(x: T, y: u8, z: u16) -> T {}
^

error: Return type of impl function `MyImpl::bar` is incompatible with `MyTrait::bar`. Expected: `<missing>`, actual: `core::integer::u8`.
--> lib.cairo:8:17
fn bar() -> u8 {
^^
4 changes: 2 additions & 2 deletions crates/cairo-lang-semantic/src/items/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3111,7 +3111,7 @@ fn validate_impl_function_signature(
let expected_ty = inference.rewrite(trait_param.ty).no_err();
let actual_ty = inference.rewrite(param.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(
&extract_matches!(
signature_syntax.parameters(syntax_db).elements(syntax_db)[idx]
Expand Down Expand Up @@ -3167,7 +3167,7 @@ fn validate_impl_function_signature(
let expected_ty = inference.rewrite(concrete_trait_signature.return_type).no_err();
let actual_ty = inference.rewrite(signature.return_type).no_err();

if expected_ty != actual_ty {
if expected_ty != actual_ty && !expected_ty.is_missing(db) && !actual_ty.is_missing(db) {
let location_ptr = match signature_syntax.ret_ty(syntax_db) {
OptionReturnTypeClause::ReturnTypeClause(ret_ty) => {
ret_ty.ty(syntax_db).as_syntax_node()
Expand Down

0 comments on commit 4d5db86

Please sign in to comment.