Commit cf59cee
[syntax-errors]
## Summary
Part of #17412
Add a new compile-time syntax error for detecting `nonlocal`
declarations at a module level.
## Test Plan
- Added new inline tests for the syntax error
- Updated existing tests for `nonlocal` statement parsing to be inside a
function scope
Co-authored-by: Brent Westbrook <36778786+ntBre@users.noreply.github.com>nonlocal declaration at module level (#17559)1 parent 538393d commit cf59cee
File tree
16 files changed
+363
-131
lines changed- crates
- ruff_linter/src/checkers/ast
- ruff_python_parser
- resources/inline
- err
- ok
- src
- parser
- tests
- snapshots
16 files changed
+363
-131
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
| 619 | + | |
| 620 | + | |
620 | 621 | | |
621 | 622 | | |
622 | 623 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
897 | 897 | | |
898 | 898 | | |
899 | 899 | | |
900 | | - | |
901 | | - | |
902 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
903 | 904 | | |
904 | 905 | | |
905 | | - | |
| 906 | + | |
| 907 | + | |
906 | 908 | | |
907 | 909 | | |
908 | 910 | | |
909 | 911 | | |
910 | 912 | | |
911 | 913 | | |
912 | 914 | | |
913 | | - | |
| 915 | + | |
| 916 | + | |
914 | 917 | | |
915 | 918 | | |
916 | 919 | | |
917 | 920 | | |
918 | 921 | | |
919 | 922 | | |
920 | 923 | | |
921 | | - | |
922 | | - | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
923 | 927 | | |
924 | 928 | | |
925 | 929 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
145 | 161 | | |
146 | 162 | | |
147 | 163 | | |
| |||
933 | 949 | | |
934 | 950 | | |
935 | 951 | | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
936 | 955 | | |
937 | 956 | | |
938 | 957 | | |
| |||
1254 | 1273 | | |
1255 | 1274 | | |
1256 | 1275 | | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
1257 | 1279 | | |
1258 | 1280 | | |
1259 | 1281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
538 | 538 | | |
539 | 539 | | |
540 | 540 | | |
541 | | - | |
| 541 | + | |
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
| |||
0 commit comments