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

added validations for traitItemInfo #7237

Merged
merged 1 commit into from
Feb 11, 2025
Merged

Conversation

dean-starkware
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from 84d0cba to 69924d3 Compare February 7, 2025 14:02
Copy link
Collaborator Author

@dean-starkware dean-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 5 files reviewed, 1 unresolved discussion


a discussion (no related file):
Note that support for impl will be submitted in a different PR.

@dean-starkware dean-starkware marked this pull request as ready for review February 7, 2025 14:13
@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch 3 times, most recently from 4ed5709 to 3ba357a Compare February 9, 2025 09:56
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 3 files at r2, 1 of 3 files at r3.
Reviewable status: 1 of 7 files reviewed, 4 unresolved discussions (waiting on @gilbens-starkware)


crates/cairo-lang-semantic/src/items/feature_kind.rs line 78 at r2 (raw file):

    /// Returns the `FeatureKind` associated with the implementing struct.
    fn get_feature_kind(&self) -> FeatureKind;
}

Suggestion:

/// A trait for retrieving the `FeatureKind` of an item.
pub trait HasFeatureKind {
    /// Returns the `FeatureKind` associated with the implementing struct.
    fn feature_kind(&self) -> FeatureKind;
}

crates/cairo-lang-semantic/src/expr/compute.rs line 2846 at r2 (raw file):

    };
    let func_name = segment.identifier(syntax_db);
    let generic_args_syntax: Option<Vec<ast::GenericArg>> = segment.generic_args(syntax_db);

revert


crates/cairo-lang-semantic/src/expr/compute.rs line 2896 at r2 (raw file):

        )?;

    // Validate if the function is usable before inserting it into `used_items`.

useless doc - especially the second part.re

Code quote:

    // Validate if the function is usable before inserting it into `used_items`.

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from 3ba357a to 418827c Compare February 9, 2025 10:41
Copy link
Collaborator Author

@dean-starkware dean-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 7 files reviewed, 4 unresolved discussions (waiting on @gilbens-starkware and @orizi)


crates/cairo-lang-semantic/src/expr/compute.rs line 2846 at r2 (raw file):

Previously, orizi wrote…

revert

Done.


crates/cairo-lang-semantic/src/expr/compute.rs line 2896 at r2 (raw file):

Previously, orizi wrote…

useless doc - especially the second part.re

Done.


crates/cairo-lang-semantic/src/items/feature_kind.rs line 78 at r2 (raw file):

    /// Returns the `FeatureKind` associated with the implementing struct.
    fn get_feature_kind(&self) -> FeatureKind;
}

Done.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 3 files at r3, 5 of 7 files at r4, all commit messages.
Reviewable status: 7 of 9 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware)


crates/cairo-lang-semantic/src/items/module.rs line 291 at r4 (raw file):

impl HasFeatureKind for ModuleItemInfo {
    fn feature_kind(&self) -> FeatureKind {
        self.feature_kind.clone()

if requires a clone - possibly just return a & instead.

Code quote:

        self.feature_kind.clone()

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from 418827c to ac9f2d2 Compare February 9, 2025 10:56
Copy link
Collaborator Author

@dean-starkware dean-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 7 of 9 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)


crates/cairo-lang-semantic/src/items/module.rs line 291 at r4 (raw file):

Previously, orizi wrote…

if requires a clone - possibly just return a & instead.

Done.

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from ac9f2d2 to fc0271e Compare February 9, 2025 11:26
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 4 files at r5, all commit messages.
Reviewable status: 8 of 10 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware)


crates/cairo-lang-semantic/src/resolve/mod.rs line 1749 at r5 (raw file):

    /// configuration. If the item uses an unstable, deprecated, or internal feature
    /// that is not permitted, a corresponding diagnostic error is reported.
    pub fn validate_item_usability<T: HasFeatureKind>(

This is the wrong name now - it only checks features

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from fc0271e to effa77e Compare February 9, 2025 16:40
Copy link
Collaborator Author

@dean-starkware dean-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 8 of 10 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)


crates/cairo-lang-semantic/src/resolve/mod.rs line 1749 at r5 (raw file):

Previously, orizi wrote…

This is the wrong name now - it only checks features

Done.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 4 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware)

Copy link
Contributor

@gilbens-starkware gilbens-starkware left a 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 r3, 3 of 4 files at r5, 1 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @orizi)


crates/cairo-lang-semantic/src/resolve/mod.rs line 851 at r6 (raw file):

                };
                if let Ok(trait_definition_data) =
                    self.db.priv_trait_definition_data(concrete_trait_id.trait_id(self.db))

Don't call directly to the priv_trait_definition_data, add another query trait_item_info_by_name query.

Code quote:

self.db.priv_trait_definition_data

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from effa77e to 990151a Compare February 10, 2025 13:31
Copy link
Collaborator Author

@dean-starkware dean-starkware left a 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, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)


crates/cairo-lang-semantic/src/resolve/mod.rs line 851 at r6 (raw file):

Previously, gilbens-starkware (Gil Ben-Shachar) wrote…

Don't call directly to the priv_trait_definition_data, add another query trait_item_info_by_name query.

Done.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 3 of 3 files at r7, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware)

Copy link
Collaborator

@orizi orizi left a 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, 2 unresolved discussions (waiting on @gilbens-starkware)

Copy link
Contributor

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 7 files at r4, 1 of 4 files at r5, 3 of 3 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi)

@dean-starkware dean-starkware force-pushed the dean/deprecated_trait_items branch from 990151a to 5a00d55 Compare February 11, 2025 14:28
Copy link
Collaborator

@orizi orizi left a 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 r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware)

Copy link
Collaborator

@orizi orizi left a 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 @gilbens-starkware)

@dean-starkware dean-starkware added this pull request to the merge queue Feb 11, 2025
Merged via the queue into main with commit b7eea8f Feb 11, 2025
48 checks passed
@orizi orizi deleted the dean/deprecated_trait_items branch February 12, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants