-
Notifications
You must be signed in to change notification settings - Fork 596
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
allow for implicit impls for impl impl items #5915
Conversation
e1bbe1b
to
434a54a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 6 files at r1.
Reviewable status: 2 of 7 files reviewed, 6 unresolved discussions (waiting on @TomerStarkware)
crates/cairo-lang-semantic/src/db.rs
line 707 at r1 (raw file):
fn impl_item_by_name(&self, impl_def_id: ImplDefId, name: SmolStr) -> Maybe<Option<ImplItemId>>; /// Returns something
?
crates/cairo-lang-semantic/src/db.rs
line 760 at r1 (raw file):
trait_impl_id: TraitImplId, ) -> Maybe<ImplImplDefId>; /// Returns something
?
crates/cairo-lang-semantic/src/db.rs
line 969 at r1 (raw file):
#[salsa::invoke(items::imp::implicit_impl_impl_impl)] #[salsa::cycle(items::imp::implicit_impl_impl_impl_cycle)] fn implicit_impl_impl_impl(
doc
crates/cairo-lang-semantic/src/items/imp.rs
line 906 at r1 (raw file):
impl_def_id: ImplDefId, trait_impl_id: TraitImplId, ) -> Maybe<Option<TraitImplId>> {
is the input and the output the same value?
Code quote:
trait_impl_id: TraitImplId,
) -> Maybe<Option<TraitImplId>> {
crates/cairo-lang-semantic/src/items/tests/trait
line 461 at r1 (raw file):
} impl MyImpl of MyTrait; ///TODO(TomerStarkware): improve diagnostics for missing impls.
Suggestion:
// TODO(TomerStarkware): improve diagnostics for missing impls.
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
^****^ error: Trait has no implementation in context: test::OtherTrait.
this should point to the problematic member as well IMO.
434a54a
to
90eddc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 7 files reviewed, 6 unresolved discussions (waiting on @orizi)
crates/cairo-lang-semantic/src/db.rs
line 707 at r1 (raw file):
Previously, orizi wrote…
?
Done.
crates/cairo-lang-semantic/src/db.rs
line 760 at r1 (raw file):
Previously, orizi wrote…
?
Done.
crates/cairo-lang-semantic/src/db.rs
line 969 at r1 (raw file):
Previously, orizi wrote…
doc
Done.
crates/cairo-lang-semantic/src/items/imp.rs
line 906 at r1 (raw file):
Previously, orizi wrote…
is the input and the output the same value?
if the outer impl does not explicitly contain the trait impl
can be refactored to is implicit impl impl
crates/cairo-lang-semantic/src/items/tests/trait
line 461 at r1 (raw file):
} impl MyImpl of MyTrait; ///TODO(TomerStarkware): improve diagnostics for missing impls.
Done.
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, orizi wrote…
this should point to the problematic member as well IMO.
I agree, but infrence.finalize does not return the errors
I can check explicitly if the var created is in refuted, or ambiguous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 3 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: 6 of 7 files reviewed, 4 unresolved discussions (waiting on @TomerStarkware)
crates/cairo-lang-semantic/src/db.rs
line 760 at r3 (raw file):
trait_impl_id: TraitImplId, ) -> Maybe<ImplImplDefId>; /// Returns whether `trait_impl_id` is an implicit impl in `impl_def_id`.
function does not return a bool.
crates/cairo-lang-semantic/src/items/imp.rs
line 906 at r1 (raw file):
Previously, TomerStarkware wrote…
if the outer impl does not explicitly contain the trait impl
can be refactored tois implicit impl impl
please do.
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, TomerStarkware wrote…
I agree, but infrence.finalize does not return the errors
I can check explicitly if the var created is in refuted, or ambiguous
but you do know the point you try to solve - have a diagnostic wrapping the inference error for impl item.
90eddc3
to
a322cf6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 of 7 files reviewed, 4 unresolved discussions (waiting on @orizi)
crates/cairo-lang-semantic/src/db.rs
line 760 at r3 (raw file):
Previously, orizi wrote…
function does not return a bool.
changed
crates/cairo-lang-semantic/src/items/imp.rs
line 906 at r1 (raw file):
Previously, orizi wrote…
please do.
Done.
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, orizi wrote…
but you do know the point you try to solve - have a diagnostic wrapping the inference error for impl item.
if I use inference.solve is there a way to tell which impl was unsolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r4, all commit messages.
Reviewable status: 6 of 7 files reviewed, 1 unresolved discussion (waiting on @TomerStarkware)
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, TomerStarkware wrote…
if I use inference.solve is there a way to tell which impl was unsolved?
Don't you solve per item now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 6 of 7 files reviewed, 1 unresolved discussion (waiting on @orizi)
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, orizi wrote…
Don't you solve per item now?
wdym? I use inference.finalize in priv_implicit_impl_impl_semantic_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 6 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @TomerStarkware)
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, TomerStarkware wrote…
wdym? I use inference.finalize in priv_implicit_impl_impl_semantic_data
But you can do it per item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi)
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, orizi wrote…
But you can do it per item.
I meant if when I use inference.solve there more error which could be unrelated to the current implicit impl I am trying to solve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @TomerStarkware)
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, TomerStarkware wrote…
I meant if when I use inference.solve there more error which could be unrelated to the current implicit impl I am trying to solve
But you can still just solve it on the spot, item by item, so you'd know which what failed for which.
a322cf6
to
ff41e1f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 4 of 8 files reviewed, 1 unresolved discussion (waiting on @orizi)
crates/cairo-lang-semantic/src/items/tests/trait
line 516 at r1 (raw file):
Previously, orizi wrote…
But you can still just solve it on the spot, item by item, so you'd know which what failed for which.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TomerStarkware)
This change is