diff --git a/crates/cairo-lang-defs/src/ids.rs b/crates/cairo-lang-defs/src/ids.rs index 4b5067fa46d..fa0afb96788 100644 --- a/crates/cairo-lang-defs/src/ids.rs +++ b/crates/cairo-lang-defs/src/ids.rs @@ -408,7 +408,7 @@ impl ImplTypeDefId { } impl TopLevelLanguageElementId for ImplTypeDefId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.impl_def_id(db).name(db), self.name(db)) + format!("{}::{}", self.impl_def_id(db).full_path(db), self.name(db)) } } @@ -431,7 +431,7 @@ impl ImplConstantDefId { } impl TopLevelLanguageElementId for ImplConstantDefId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.impl_def_id(db).name(db), self.name(db)) + format!("{}::{}", self.impl_def_id(db).full_path(db), self.name(db)) } } @@ -454,7 +454,7 @@ impl ImplImplDefId { } impl TopLevelLanguageElementId for ImplImplDefId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.impl_def_id(db).name(db), self.name(db)) + format!("{}::{}", self.impl_def_id(db).full_path(db), self.name(db)) } } @@ -566,7 +566,7 @@ impl TraitTypeId { } impl TopLevelLanguageElementId for TraitTypeId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.trait_id(db).name(db), self.name(db)) + format!("{}::{}", self.trait_id(db).full_path(db), self.name(db)) } } @@ -588,7 +588,7 @@ impl TraitConstantId { } impl TopLevelLanguageElementId for TraitConstantId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.trait_id(db).name(db), self.name(db)) + format!("{}::{}", self.trait_id(db).full_path(db), self.name(db)) } } @@ -610,7 +610,7 @@ impl TraitImplId { } impl TopLevelLanguageElementId for TraitImplId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.trait_id(db).name(db), self.name(db)) + format!("{}::{}", self.trait_id(db).full_path(db), self.name(db)) } } @@ -632,26 +632,53 @@ impl TraitFunctionId { } impl TopLevelLanguageElementId for TraitFunctionId { fn full_path(&self, db: &dyn DefsGroup) -> String { - format!("{}::{}", self.trait_id(db).name(db), self.name(db)) + format!("{}::{}", self.trait_id(db).full_path(db), self.name(db)) } } // --- Struct items --- -// TODO(spapini): Override full_path for to include parents, for better debug. -define_top_level_language_element_id!( +define_named_language_element_id!( MemberId, MemberLongId, ast::Member, lookup_intern_member, intern_member ); -define_top_level_language_element_id!( +impl MemberId { + pub fn struct_id(&self, db: &dyn DefsGroup) -> StructId { + let MemberLongId(module_file_id, ptr) = self.lookup_intern(db); + let struct_ptr = ast::ItemStructPtr(ptr.untyped().nth_parent(db.upcast(), 2)); + StructLongId(module_file_id, struct_ptr).intern(db) + } +} + +impl TopLevelLanguageElementId for MemberId { + fn full_path(&self, db: &dyn DefsGroup) -> String { + format!("{}::{}", self.struct_id(db).full_path(db), self.name(db)) + } +} + +// --- Enum variants --- +define_named_language_element_id!( VariantId, VariantLongId, ast::Variant, lookup_intern_variant, intern_variant ); +impl VariantId { + pub fn enum_id(&self, db: &dyn DefsGroup) -> EnumId { + let VariantLongId(module_file_id, ptr) = self.lookup_intern(db); + let struct_ptr = ast::ItemEnumPtr(ptr.untyped().nth_parent(db.upcast(), 2)); + EnumLongId(module_file_id, struct_ptr).intern(db) + } +} + +impl TopLevelLanguageElementId for VariantId { + fn full_path(&self, db: &dyn DefsGroup) -> String { + format!("{}::{}", self.enum_id(db).full_path(db), self.name(db)) + } +} define_language_element_id_as_enum! { /// Id for any variable definition. diff --git a/crates/cairo-lang-lowering/src/lower/test_data/closure b/crates/cairo-lang-lowering/src/lower/test_data/closure index 2d60f132860..027745207ac 100644 --- a/crates/cairo-lang-lowering/src/lower/test_data/closure +++ b/crates/cairo-lang-lowering/src/lower/test_data/closure @@ -39,7 +39,7 @@ End: Return(v4, v5, v6) -Generated Destruct::destruct lowering for source location: +Generated core::traits::Destruct::destruct lowering for source location: || { ^^ @@ -62,7 +62,7 @@ End: Return(v5, v6, v7) -Generated FnOnce::call lowering for source location: +Generated core::ops::function::FnOnce::call lowering for source location: || { ^^ @@ -160,7 +160,7 @@ End: Return(v13) -Generated PanicDestruct::panic_destruct lowering for source location: +Generated core::traits::PanicDestruct::panic_destruct lowering for source location: || { ^^ @@ -183,7 +183,7 @@ End: Return(v3) -Generated FnOnce::call lowering for source location: +Generated core::ops::function::FnOnce::call lowering for source location: || { ^^ @@ -256,7 +256,7 @@ End: Return() -Generated FnOnce::call lowering for source location: +Generated core::ops::function::FnOnce::call lowering for source location: let c = || a; ^^ diff --git a/crates/cairo-lang-semantic/src/expr/test_data/closure b/crates/cairo-lang-semantic/src/expr/test_data/closure index 30974a332e0..90f695147d9 100644 --- a/crates/cairo-lang-semantic/src/expr/test_data/closure +++ b/crates/cairo-lang-semantic/src/expr/test_data/closure @@ -534,7 +534,7 @@ error: Function not found. let _f: u32 = bar(a).unwrap(); ^*^ -error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: OptionTrait::unwrap and ResultTrait::unwrap. Consider adding type annotations or explicitly refer to the impl function. +error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: core::option::OptionTrait::unwrap and core::result::ResultTrait::unwrap. Consider adding type annotations or explicitly refer to the impl function. --> lib.cairo:10:26 let _f: u32 = bar(a).unwrap(); ^****^ diff --git a/crates/cairo-lang-semantic/src/expr/test_data/function_call b/crates/cairo-lang-semantic/src/expr/test_data/function_call index f2a569b1420..aaa69617cdf 100644 --- a/crates/cairo-lang-semantic/src/expr/test_data/function_call +++ b/crates/cairo-lang-semantic/src/expr/test_data/function_call @@ -172,7 +172,7 @@ error[E0002]: Method `bar` not found on type `test::MyStruct`. Did you import th ^*^ error[E0002]: Method `baz` could not be called on type `test::MyStruct`. -Candidate `MyTrait::baz` inference failed with: Trait has no implementation in context: test::MyTrait::. +Candidate `test::MyTrait::baz` inference failed with: Trait has no implementation in context: test::MyTrait::. --> lib.cairo:16:7 d.baz(); ^*^ diff --git a/crates/cairo-lang-semantic/src/expr/test_data/method b/crates/cairo-lang-semantic/src/expr/test_data/method index c3498eed4dd..2ef5ab033f3 100644 --- a/crates/cairo-lang-semantic/src/expr/test_data/method +++ b/crates/cairo-lang-semantic/src/expr/test_data/method @@ -88,7 +88,7 @@ error[E0002]: Method `is_foo` not found on type `core::option::Option::`. Di x.is_foo(); ^****^ -error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: MyTrait::is_bar and AnotherTrait::is_bar. Consider adding type annotations or explicitly refer to the impl function. +error: Ambiguous method call. More than one applicable trait function with a suitable self type was found: test::MyTrait::is_bar and test::AnotherTrait::is_bar. Consider adding type annotations or explicitly refer to the impl function. --> lib.cairo:40:7 y.is_bar(); ^****^ @@ -317,7 +317,7 @@ trait MyTrait { //! > expected_diagnostics error[E0002]: Method `bar` could not be called on type `core::integer::u16`. -Candidate `MyTrait::bar` inference failed with: Trait has no implementation in context: test::MyTrait::. +Candidate `test::MyTrait::bar` inference failed with: Trait has no implementation in context: test::MyTrait::. --> lib.cairo:5:11 3_u16.bar(); ^*^ @@ -344,7 +344,7 @@ trait MyTrait { //! > expected_diagnostics error[E0002]: Method `bar` could not be called on type `core::integer::u16`. -Candidate `MyTrait::bar` inference failed with: Trait has no implementation in context: test::MyTrait::. +Candidate `test::MyTrait::bar` inference failed with: Trait has no implementation in context: test::MyTrait::. --> lib.cairo:5:21 (3_u16 + 3_u16).bar(); ^*^ diff --git a/crates/cairo-lang-semantic/src/expr/test_data/operators b/crates/cairo-lang-semantic/src/expr/test_data/operators index 92e5eb4b159..ef0554e467e 100644 --- a/crates/cairo-lang-semantic/src/expr/test_data/operators +++ b/crates/cairo-lang-semantic/src/expr/test_data/operators @@ -128,8 +128,8 @@ impl Struct2Index of Index { //! > expected_diagnostics error: Type `test::Struct1` could not be indexed. -Candidate `Index::index` inference failed with: Trait has no implementation in context: core::ops::index::Index::. -Candidate `IndexView::index` inference failed with: Trait has no implementation in context: core::ops::index::IndexView::. +Candidate `core::ops::index::Index::index` inference failed with: Trait has no implementation in context: core::ops::index::Index::. +Candidate `core::ops::index::IndexView::index` inference failed with: Trait has no implementation in context: core::ops::index::IndexView::. --> lib.cairo:21:15 let _y1 = x1[0]; ^***^ diff --git a/crates/cairo-lang-semantic/src/items/tests/early_conform b/crates/cairo-lang-semantic/src/items/tests/early_conform index 61249bb1f1b..7570b07853f 100644 --- a/crates/cairo-lang-semantic/src/items/tests/early_conform +++ b/crates/cairo-lang-semantic/src/items/tests/early_conform @@ -28,7 +28,7 @@ fn main() -> MyType { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:11 3_u16.my_into() ^*****^ @@ -65,7 +65,7 @@ fn main() -> MyType { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:18 return 3_u16.my_into(); ^*****^ @@ -102,7 +102,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:27 let _: MyType = 3_u16.my_into(); ^*****^ @@ -139,13 +139,13 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:38 let _: (MyType, MyType) = (3_u16.my_into(), 3_u16.my_into()); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:55 let _: (MyType, MyType) = (3_u16.my_into(), 3_u16.my_into()); ^*****^ @@ -191,7 +191,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:19:32 let _: MyBoolType = !3_u16.my_into(); ^*****^ @@ -228,7 +228,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:29 let _: @MyType = @3_u16.my_into(); ^*****^ @@ -265,7 +265,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:30 let _: MyType = *(@3_u16.my_into()); ^*****^ @@ -344,19 +344,19 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:33 let _: [MyType; 2] = [3_u16.my_into(); 2]; ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:15:33 let _: [MyType; 2] = [3_u16.my_into(), 3_u16.my_into()]; ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:15:50 let _: [MyType; 2] = [3_u16.my_into(), 3_u16.my_into()]; ^*****^ @@ -400,13 +400,13 @@ fn main(my_enum: MyEnum) { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:19:28 MyEnum::A => 3_u16.my_into(), ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:20:28 MyEnum::B => 3_u16.my_into() ^*****^ @@ -449,19 +449,19 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:15:15 3_u16.my_into() ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:17:15 3_u16.my_into() ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:19:15 3_u16.my_into() ^*****^ @@ -500,7 +500,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:15:21 break 3_u16.my_into(); ^*****^ @@ -541,7 +541,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:16:25 break 3_u16.my_into(); ^*****^ @@ -582,7 +582,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:16:25 break 3_u16.my_into(); ^*****^ @@ -623,7 +623,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:16:25 break 3_u16.my_into(); ^*****^ @@ -671,13 +671,13 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:22:25 break 3_u16.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:24:21 break 3_u16.my_into(); ^*****^ @@ -735,37 +735,37 @@ fn main() -> MyType16 { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:26:18 return 3_u16.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u32`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:28:21 break 3_u32.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u64`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:30:25 break 3_u64.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u32`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:32:21 break 3_u32.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:34:18 return 3_u16.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:35:11 3_u16.my_into() ^*****^ @@ -812,13 +812,13 @@ fn main(other: MyGenericType) { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:24:61 let _: MyGenericType = MyGenericType { x: 3_u16.my_into(), ..2_u32.my_into() }; ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u32`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:24:80 let _: MyGenericType = MyGenericType { x: 3_u16.my_into(), ..2_u32.my_into() }; ^*****^ @@ -855,7 +855,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:48 let _: Option = Option::Some(3_u16.my_into()); ^*****^ @@ -893,7 +893,7 @@ fn bar(_x: MyType) {} //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:15 bar(3_u16.my_into()); ^*****^ @@ -936,7 +936,7 @@ impl MyImpl of MyTrait { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:21 3_u32.bar(3_u16.my_into()); ^*****^ @@ -981,13 +981,13 @@ impl MyIndexView of IndexView { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:15:13 x[3_u16.my_into()]; ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:16:17 3_u64[3_u16.my_into()]; ^*****^ @@ -1029,7 +1029,7 @@ impl MyAdd of Add { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:31 let _ = MyType {} + 3_u16.my_into(); ^*****^ @@ -1068,7 +1068,7 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:16:15 x = 3_u16.my_into(); ^*****^ @@ -1109,25 +1109,25 @@ fn main() { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:15:38 let _: bool = MyType {} == 3_u16.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:16:43 let _: bool = @(MyType {}) == @(3_u16.my_into()); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:17:38 let _: bool = MyType {} != 3_u16.my_into(); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:18:43 let _: bool = @(MyType {}) != @(3_u16.my_into()); ^*****^ @@ -1165,7 +1165,7 @@ fn main() -> Option<()> { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:40 let _: MyType = Option::Some(3_u16.my_into())?; ^*****^ @@ -1203,7 +1203,7 @@ fn main() -> Result<(), ()> { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:38 let _: MyType = Result::Ok(3_u16.my_into())?; ^*****^ @@ -1241,7 +1241,7 @@ fn main() -> Result<(), MyType> { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:14:35 let _: () = Result::Err(3_u16.my_into())?; ^*****^ diff --git a/crates/cairo-lang-semantic/src/items/tests/trait_type b/crates/cairo-lang-semantic/src/items/tests/trait_type index a3dc008f7f6..82d4a89a466 100644 --- a/crates/cairo-lang-semantic/src/items/tests/trait_type +++ b/crates/cairo-lang-semantic/src/items/tests/trait_type @@ -716,8 +716,8 @@ impl MyImpl of MyTrait { //! > expected_diagnostics error[E0002]: Method `unwrap` could not be called on type `core::integer::u32`. -Candidate `OptionTrait::unwrap` inference failed with: Type mismatch: `core::integer::u32` and `core::option::Option::`. -Candidate `ResultTrait::unwrap` inference failed with: Type mismatch: `core::integer::u32` and `core::result::Result::`. +Candidate `core::option::OptionTrait::unwrap` inference failed with: Type mismatch: `core::integer::u32` and `core::option::Option::`. +Candidate `core::result::ResultTrait::unwrap` inference failed with: Type mismatch: `core::integer::u32` and `core::result::Result::`. --> lib.cairo:8:11 x.unwrap(); ^****^ @@ -904,8 +904,8 @@ impl MyImpl of MyTrait { //! > expected_diagnostics error: Type `core::integer::u32` could not be indexed. -Candidate `Index::index` inference failed with: Trait has no implementation in context: core::ops::index::Index::. -Candidate `IndexView::index` inference failed with: Trait has no implementation in context: core::ops::index::IndexView::. +Candidate `core::ops::index::Index::index` inference failed with: Trait has no implementation in context: core::ops::index::Index::. +Candidate `core::ops::index::IndexView::index` inference failed with: Trait has no implementation in context: core::ops::index::IndexView::. --> lib.cairo:8:9 x[0]; ^**^ @@ -1969,25 +1969,25 @@ impl MyImpl of MyTrait { //! > expected_diagnostics error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:20:43 let _: Self::MyTraitType = (3_u16.my_into(), 3_u16.my_into()); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:20:60 let _: Self::MyTraitType = (3_u16.my_into(), 3_u16.my_into()); ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:21:16 (3_u16.my_into(), 3_u16.my_into()) ^*****^ error[E0002]: Method `my_into` could not be called on type `core::integer::u16`. -Candidate `MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. +Candidate `test::MyInto::my_into` inference failed with: Trait has no implementation in context: test::MyInto::. --> lib.cairo:21:33 (3_u16.my_into(), 3_u16.my_into()) ^*****^ diff --git a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics index 2ead4ffdb1e..0fa6adfdc93 100644 --- a/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics +++ b/crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/diagnostics @@ -9741,7 +9741,7 @@ error: ref argument must be a variable. ^***^ error[E0002]: Method `foo1` could not be called on type `test::component2::ComponentState::`. -Candidate `Comp1HelperTrait::foo1` inference failed with: Type mismatch: `test::component2::ComponentState::` and `@test::component1::ComponentState::`. +Candidate `test::component1::Comp1HelperTrait::foo1` inference failed with: Type mismatch: `test::component2::ComponentState::` and `@test::component1::ComponentState::`. --> lib.cairo:54:53 get_dep_component_mut!(ref self, Comp2).foo1(); ^**^ @@ -10874,8 +10874,8 @@ mod contract { //! > expected_diagnostics error[E0002]: Method `write` could not be called on type `core::starknet::storage::storage_base::StorageBase::`. -Candidate `StorageMapWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::map::StorageMapWriteAccess::>. -Candidate `StoragePointerWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::StoragePointerWriteAccess::>. +Candidate `core::starknet::storage::map::StorageMapWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::map::StorageMapWriteAccess::>. +Candidate `core::starknet::storage::StoragePointerWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::StoragePointerWriteAccess::>. --> lib.cairo:18:27 self.a_member.write(0); ^***^ @@ -11671,8 +11671,8 @@ mod contract { //! > expected_diagnostics error[E0002]: Method `write` could not be called on type `core::starknet::storage::storage_base::StorageBase::`. -Candidate `StorageMapWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::map::StorageMapWriteAccess::>. -Candidate `StoragePointerWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::StoragePointerWriteAccess::>. +Candidate `core::starknet::storage::map::StorageMapWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::map::StorageMapWriteAccess::>. +Candidate `core::starknet::storage::StoragePointerWriteAccess::write` inference failed with: Trait has no implementation in context: core::starknet::storage::StoragePointerWriteAccess::>. --> lib.cairo:35:40 self.component_member.data.write(); ^***^ @@ -12684,7 +12684,7 @@ error: Type "core::starknet::storage::storage_base::StorageBase:: lib.cairo:59:30 self.u256_pair.a.read() ^**^