[syntax-errors] nonlocal declaration at module level#17559
[syntax-errors] nonlocal declaration at module level#17559ntBre merged 2 commits intoastral-sh:mainfrom
nonlocal declaration at module level#17559Conversation
|
@dhruvmanila could you review this? |
ntBre
left a comment
There was a problem hiding this comment.
Awesome, thanks! I had one suggestion about where to put tests, but this looks great to me.
|
(I'll leave this to Brent) |
|
@ntBre Thanks for the review. I've addressed your comment and pushed again. I have one question -- since it looks like this repo follows the squash+merge git workflow, should I be updating the PR description every time I push after addressing review comments (since this description will end up in the commit message)? (Edit: updated the PR description) |
|
(Resolved conflicts in the last push) |
Great question! I would say not to worry too much about it, but it is definitely nice to keep it updated if things change substantially. Your edits here look perfect. |
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| AIR311 | 12 | 0 | 0 | 0 | 12 |
Formatter (stable)
✅ ecosystem check detected no format changes.
Formatter (preview)
✅ ecosystem check detected no format changes.
nonlocal declaration at module level
Got it, thanks! Also wanted to mention that your detailed issue write up was really helpful from a new contributor (ie, me) POV, so thanks for that as well 😄 |
|
Thank you, that's great to hear! And thanks for the great PRs! |
* main: (24 commits) [`airflow`] Extend `AIR301` rule (#17598) [`airflow`] update existing `AIR302` rules with better suggestions (#17542) red_knot_project: sort diagnostics from checking files [red-knot] fix detecting a metaclass on a not-explicitly-specialized generic base (#17621) [red-knot] fix inheritance-cycle detection for generic classes (#17620) [`pylint`] Detect `global` declarations in module scope (`PLE0118`) (#17411) Add Semantic Error Test for LateFutureImport (#17612) [red-knot] change TypeVarInstance to be interned, not tracked (#17616) [red-knot] Special case `@final`, `@override` (#17608) [red-knot] add TODO comment in specialization code (#17615) [`semantic-syntax-errors`] test for `LoadBeforeGlobalDeclaration` - ruff linter (#17592) [syntax-errors] `nonlocal` declaration at module level (#17559) [`airflow`] Apply auto fix to cases where name has been changed in Airflow 3 (`AIR311`) (#17571) [syntax-errors] Make `async-comprehension-in-sync-comprehension` more specific (#17460) Bump 0.11.7 (#17613) [red-knot] Use iterative approach to collect overloads (#17607) red_knot_python_semantic: avoid Rust's screaming snake case convention in mdtest red_knot_python_semantic: improve diagnostics for unsupported boolean conversions red_knot_python_semantic: add "return type span" helper method red_knot_python_semantic: move parameter span helper method ...
* main: (27 commits) [red-knot] Add new property tests for subtyping with "bottom" callable (#17635) [red-knot] Create generic context for generic classes lazily (#17617) ruff_db: add tests for annotations with no ranges [`airflow`] Extend `AIR301` rule (#17598) [`airflow`] update existing `AIR302` rules with better suggestions (#17542) red_knot_project: sort diagnostics from checking files [red-knot] fix detecting a metaclass on a not-explicitly-specialized generic base (#17621) [red-knot] fix inheritance-cycle detection for generic classes (#17620) [`pylint`] Detect `global` declarations in module scope (`PLE0118`) (#17411) Add Semantic Error Test for LateFutureImport (#17612) [red-knot] change TypeVarInstance to be interned, not tracked (#17616) [red-knot] Special case `@final`, `@override` (#17608) [red-knot] add TODO comment in specialization code (#17615) [`semantic-syntax-errors`] test for `LoadBeforeGlobalDeclaration` - ruff linter (#17592) [syntax-errors] `nonlocal` declaration at module level (#17559) [`airflow`] Apply auto fix to cases where name has been changed in Airflow 3 (`AIR311`) (#17571) [syntax-errors] Make `async-comprehension-in-sync-comprehension` more specific (#17460) Bump 0.11.7 (#17613) [red-knot] Use iterative approach to collect overloads (#17607) red_knot_python_semantic: avoid Rust's screaming snake case convention in mdtest ...
Summary
Part of #17412
Add a new compile-time syntax error for detecting
nonlocaldeclarations at a module level.Test Plan
nonlocalstatement parsing to be inside a function scope