red-knot: Use parse_unchecked to get all parse errors#11725
Merged
MichaReiser merged 3 commits intomainfrom Jun 4, 2024
Merged
red-knot: Use parse_unchecked to get all parse errors#11725MichaReiser merged 3 commits intomainfrom
parse_unchecked to get all parse errors#11725MichaReiser merged 3 commits intomainfrom
Conversation
Contributor
|
carljm
approved these changes
Jun 3, 2024
Contributor
carljm
left a comment
There was a problem hiding this comment.
Looks good! Love a PR that removes more lines of code than it adds.
| file_id: *file_id, | ||
| source, | ||
| parsed, | ||
| parsed: &*parsed, |
Contributor
There was a problem hiding this comment.
Why do we need the reborrow here?
Member
Author
There was a problem hiding this comment.
parsed returns an Arc<Parsed<...>>. We could either pass in the owned Arc, or just the reference as I do here because we never need to clone (and the context already has lifetimes anyway)
dhruvmanila
approved these changes
Jun 4, 2024
6050bc1 to
8f75726
Compare
carljm
added a commit
that referenced
this pull request
Jun 4, 2024
* main: CI: add job to run tests under minimum supported rust version (msrv) (#11737) Lexer should consider BOM for the start offset (#11732) Use cursor offset for lexer checkpoint (#11734) red-knot: Change `resolve_global_symbol` to take `Module` as an argument (#11723) red-knot: Use `parse_unchecked` to get all parse errors (#11725) Respect per-file ignores for blanket and redirected noqa rules (#11728) [`pygrep_hooks`] Check blanket ignores via file-level pragmas (`PGH004`) (#11540)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The parser now supports to return all parse errors instead of just the first. Let's use that and also reuse the ast's
Parsedmodule instead of defining our own.Test Plan
cargo test