Skip to content

red-knot: Use parse_unchecked to get all parse errors - #11725

Merged
MichaReiser merged 3 commits into
mainfrom
red-knot-use-parse-unchecked
Jun 4, 2024
Merged

MichaReiser merged 3 commits into
mainfrom
red-knot-use-parse-unchecked

Conversation

@MichaReiser

Copy link
Copy Markdown
Member

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 Parsed module instead of defining our own.

Test Plan

cargo test

@MichaReiser MichaReiser added the ty The ty type checker label Jun 3, 2024
@github-actions

github-actions Bot commented Jun 3, 2024 •

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@carljm carljm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Love a PR that removes more lines of code than it adds.

Comment thread crates/red_knot/src/lint.rs Outdated
file_id: *file_id,
source,
parsed,
parsed: &*parsed,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need the reborrow here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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)

Comment thread crates/red_knot/src/parse.rs
@MichaReiser
MichaReiser force-pushed the red-knot-use-parse-unchecked branch from 6050bc1 to 8f75726 Compare June 4, 2024 05:59
@MichaReiser
MichaReiser enabled auto-merge (squash) June 4, 2024 05:59
@MichaReiser
MichaReiser merged commit 64165be into main Jun 4, 2024
@MichaReiser
MichaReiser deleted the red-knot-use-parse-unchecked branch June 4, 2024 06:04
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants