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

filter diagnostics #6001

Merged
merged 1 commit into from
Jul 10, 2024
Merged

Conversation

Tomer-StarkWare
Copy link
Collaborator

@Tomer-StarkWare Tomer-StarkWare commented Jul 10, 2024

This change is Reviewable

Copy link
Contributor

@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 15 files at r1, all commit messages.
Reviewable status: 1 of 15 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware, @orizi, and @Tomer-StarkWare)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 309 at r1 (raw file):

    }

    pub fn get_all(&self, with_duplicates: bool, db: &TEntry::DbType) -> Vec<TEntry> {

plz doc. Explain what "duplicates" are because this is not obvious to me.

Copy link
Contributor

@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 14 of 15 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware, @orizi, and @Tomer-StarkWare)

Copy link
Collaborator Author

@Tomer-StarkWare Tomer-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, 1 unresolved discussion (waiting on @gilbens-starkware, @mkaput, and @orizi)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 309 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

plz doc. Explain what "duplicates" are because this is not obvious to me.

Done.

Copy link
Contributor

@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.

Reviewable status: 11 of 15 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware, @orizi, and @Tomer-StarkWare)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 309 at r1 (raw file):

Previously, Tomer-StarkWare (TomerC-StarkWare) wrote…

Done.

please doc what is considered a "duplicate". same message? same location? both?

Copy link
Collaborator Author

@Tomer-StarkWare Tomer-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: 11 of 15 files reviewed, 1 unresolved discussion (waiting on @gilbens-starkware, @mkaput, and @orizi)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 309 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

please doc what is considered a "duplicate". same message? same location? both?

Done.

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.

Reviewable status: 11 of 15 files reviewed, 3 unresolved discussions (waiting on @mkaput, @orizi, and @Tomer-StarkWare)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 309 at r1 (raw file):

Previously, mkaput (Marek Kaput) wrote…

please doc what is considered a "duplicate". same message? same location? both?

+1


crates/cairo-lang-diagnostics/src/diagnostics.rs line 49 at r2 (raw file):

        None
    }
    /// Returns true if the two diagnostics are of the same kind.

As not any diagnostic must have a kind field, it is worth adding this clarification.

Suggestion:

/// Returns true if the two should be regarded as the same kind when filtering duplicate diagnostics.

crates/cairo-lang-diagnostics/src/diagnostics.rs line 317 at r2 (raw file):

        for (idx, diag) in diagnostic_with_dup.iter().enumerate() {
            indexed_dup_diagnostic.push((idx, diag));
        }

Suggestion:

        let indexed_dup_diagnostic = diagnostic_with_dup.iter().enumerate().map(|idx, diag| (idx, diag));

Copy link
Contributor

@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 3 of 4 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @orizi and @Tomer-StarkWare)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 308 at r3 (raw file):

    /// Get diagnostics without duplication, such that there will be no 2 diagnostics that points to
    /// the same location in the user code, and are of the same kind.

nit

Suggestion:

    /// Get diagnostics without duplication.
    ///
    /// Two diagnostics are considered duplicated if both point to
    /// the same location in the user code, and are of the same kind.

Copy link
Collaborator Author

@Tomer-StarkWare Tomer-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: 14 of 15 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware, @mkaput, and @orizi)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 49 at r2 (raw file):

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

As not any diagnostic must have a kind field, it is worth adding this clarification.

Done.


crates/cairo-lang-diagnostics/src/diagnostics.rs line 317 at r2 (raw file):

        for (idx, diag) in diagnostic_with_dup.iter().enumerate() {
            indexed_dup_diagnostic.push((idx, diag));
        }

Done.

Copy link
Contributor

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

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.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @orizi and @Tomer-StarkWare)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 335 at r4 (raw file):

            diagnostic_without_dup.push(diag);
            prev_diagnostic_indexed = Some(diag);
        }

Suggestion:

        let mut prev_diagnostic_indexed = indexed_dup_doagnostic.next().unwrap();
        let mut diagnostic_without_dup = vec![prev_diagnostic_indexed];

        for diag in indexed_dup_diagnostic {
            if prev_diagnostic_indexed.1.is_same_kind(diag.1)
                && prev_diagnostic_indexed.1.location(db).user_location(files_db).span
                    == diag.1.location(db).user_location(files_db).span
            {
                continue;
            }
            diagnostic_without_dup.push(diag);
            prev_diagnostic_indexed = diag;
        }

Copy link
Collaborator Author

@Tomer-StarkWare Tomer-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: 12 of 15 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware, @mkaput, and @orizi)


crates/cairo-lang-diagnostics/src/diagnostics.rs line 335 at r4 (raw file):

            diagnostic_without_dup.push(diag);
            prev_diagnostic_indexed = Some(diag);
        }

Done.

Copy link
Contributor

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

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:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @orizi)

Copy link
Contributor

@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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @orizi)

Copy link
Contributor

@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:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @orizi)

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


crates/cairo-lang-lowering/src/diagnostic.rs line 105 at r5 (raw file):

    }

    fn is_same_kind(&self, _other: &Self) -> bool {

doc.
remove _

Copy link
Collaborator Author

@Tomer-StarkWare Tomer-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, 1 unresolved discussion (waiting on @orizi)


crates/cairo-lang-lowering/src/diagnostic.rs line 105 at r5 (raw file):

Previously, orizi wrote…

doc.
remove _

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 2 of 15 files at r1, 4 of 4 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Tomer-StarkWare)

Copy link
Contributor

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

@Tomer-StarkWare Tomer-StarkWare added this pull request to the merge queue Jul 10, 2024
Merged via the queue into dev-v2.7.0 with commit fc41522 Jul 10, 2024
44 checks passed
@orizi orizi deleted the tomerc/filtering-diagnostics branch July 11, 2024 11:41
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