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

Introduced default plugin suites to the RootDatabaseBuilder #6852

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

integraledelebesgue
Copy link
Member

@integraledelebesgue integraledelebesgue commented Dec 9, 2024

Stack:

⚠️ Part of a stack created by spr. Do not merge manually using the UI - doing so may have unexpected results.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)


crates/cairo-lang-semantic/src/db.rs line 1881 at r1 (raw file):

    /// Sets macro, inline macro and analyzer plugins specified in the [`PluginSuite`] as default
    /// for all crates.
    /// ***

this hr was not idiomatic

Suggestion:

    ///

crates/cairo-lang-semantic/src/db.rs line 1917 at r1 (raw file):

    /// Sets macro, inline macro and analyzer plugins present in the [`PluginSuite`] for a crate
    /// pointed to by the [`CrateId`], overriding the defaults for that crate.
    /// ***

Suggestion:

    ///

Copy link
Collaborator

@Draggu Draggu 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, 3 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)


crates/cairo-lang-semantic/src/db.rs line 1939 at r1 (raw file):

            .into_iter()
            .map(|plugin| self.intern_analyzer_plugin(AnalyzerPluginLongId(plugin)))
            .collect();

Can we deduplicate this logic? Also, make it a public api; it will be useful in LS, too.

Code quote:

        let PluginSuite { plugins, inline_macro_plugins, analyzer_plugins } = suite;

        let macro_plugins = plugins
            .into_iter()
            .map(|plugin| self.intern_macro_plugin(MacroPluginLongId(plugin)))
            .collect();

        let inline_macro_plugins = inline_macro_plugins
            .into_iter()
            .map(|(name, plugin)| {
                (name, self.intern_inline_macro_plugin(InlineMacroExprPluginLongId(plugin)))
            })
            .collect();

        let analyzer_plugins = analyzer_plugins
            .into_iter()
            .map(|plugin| self.intern_analyzer_plugin(AnalyzerPluginLongId(plugin)))
            .collect();

Copy link
Member Author

@integraledelebesgue integraledelebesgue 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: 11 of 12 files reviewed, 3 unresolved discussions (waiting on @Draggu, @mkaput, @orizi, and @piotmag769)


crates/cairo-lang-semantic/src/db.rs line 1939 at r1 (raw file):

Previously, Draggu (Piotr Figiela) wrote…

Can we deduplicate this logic? Also, make it a public api; it will be useful in LS, too.

I extracted it as another helper.
These helpers should already be public since they belong to a pub trait, mutually implemented on every type that is a SemanticGroup.

Copy link
Collaborator

@Draggu Draggu 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: 11 of 12 files reviewed, 3 unresolved discussions (waiting on @integraledelebesgue, @mkaput, @orizi, and @piotmag769)


crates/cairo-lang-semantic/src/db.rs line 1883 at r2 (raw file):

        &mut self,
        suite: PluginSuite,
    ) -> (Vec<MacroPluginId>, OrderedHashMap<String, InlineMacroExprPluginId>, Vec<AnalyzerPluginId>)

Make struct for these.

Copy link
Member

@mkaput mkaput 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 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue, @orizi, and @piotmag769)

Copy link
Member Author

@integraledelebesgue integraledelebesgue 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: 11 of 13 files reviewed, 1 unresolved discussion (waiting on @Draggu, @mkaput, @orizi, and @piotmag769)


crates/cairo-lang-semantic/src/db.rs line 1883 at r2 (raw file):

Previously, Draggu (Piotr Figiela) wrote…

Make struct for these.

Done

Copy link
Collaborator

@Draggu Draggu 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 11 of 12 files at r1, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)


crates/cairo-lang-semantic/src/db.rs line 1916 at r3 (raw file):

    /// [`DefsGroup::default_inline_macro_plugins`], and
    /// [`SemanticGroup::default_analyzer_plugins`].
    fn set_default_plugins_from_suite(&mut self, suite: PluginSuite) {

Maybe inverse this? up to you

Suggestion:

InternedPluginSuite

crates/cairo-lang-semantic/src/db.rs line 1931 at r3 (raw file):

    /// [`DefsGroup::override_crate_inline_macro_plugins`], and
    /// [`SemanticGroup::override_crate_analyzer_plugins`].
    fn set_override_crate_plugins_from_suite(&mut self, crate_id: CrateId, suite: PluginSuite) {

vide supra

Copy link
Member

@mkaput mkaput 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 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)

@integraledelebesgue integraledelebesgue force-pushed the spr/main/ffce04df branch 2 times, most recently from 4b6a57f to 8b84cb3 Compare December 13, 2024 07:13
@integraledelebesgue integraledelebesgue force-pushed the spr/main/5dc187d6 branch 2 times, most recently from 15418f8 to 0318f63 Compare December 13, 2024 07:29
@integraledelebesgue integraledelebesgue force-pushed the spr/main/ffce04df branch 2 times, most recently from 2a0cd52 to 5438ec5 Compare December 13, 2024 08:17
Copy link
Member

@mkaput mkaput 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 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @integraledelebesgue, @orizi, and @piotmag769)

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 5 of 5 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue)

Copy link
Member Author

@integraledelebesgue integraledelebesgue 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 @orizi)


crates/cairo-lang-semantic/src/plugin.rs line 84 at r5 (raw file):

Previously, orizi wrote…

tough luck - that is still the correct solution.
I don't see why you can't provide a pathway for this going towards the correct solution.

assuming the suite builder still exists - the fix should be extremely easy.

How would we rework, for example, the get_default_plugin_suite and similar functions if we want to hold the interned data in the PluginSuite instead of raw plugins? That's a significant breakage, both in the compiler and our tools.

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 @integraledelebesgue)


crates/cairo-lang-semantic/src/plugin.rs line 84 at r5 (raw file):

Previously, integraledelebesgue (Jan Smółka) wrote…

How would we rework, for example, the get_default_plugin_suite and similar functions if we want to hold the interned data in the PluginSuite instead of raw plugins? That's a significant breakage, both in the compiler and our tools.

yes - they should hold that exactly - that is definitely a very minor change.

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 12 files at r1, 2 of 2 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue)

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 2 files at r3, 4 of 4 files at r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue)

Copy link
Member

@mkaput mkaput 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 5 files at r6, 1 of 2 files at r7, 4 of 4 files at r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue)

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 1 files at r9, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @integraledelebesgue)

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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)


crates/cairo-lang-semantic/src/plugin.rs line 84 at r5 (raw file):

Previously, orizi wrote…

yes - they should hold that exactly - that is definitely a very minor change.

unblocking - would probably update on it after the later changes.

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 2 of 2 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)

Copy link
Collaborator

@piotmag769 piotmag769 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 r8, 1 of 1 files at r9, 2 of 2 files at r10, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @integraledelebesgue)

@integraledelebesgue integraledelebesgue changed the base branch from spr/main/5dc187d6 to main February 3, 2025 12:32
@integraledelebesgue integraledelebesgue added this pull request to the merge queue Feb 3, 2025
Merged via the queue into main with commit 92a440a Feb 3, 2025
48 checks passed
@orizi orizi deleted the spr/main/ffce04df branch February 5, 2025 11:07
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.

6 participants