-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only allow imports and macros directly at scope level
- Loading branch information
Showing
9 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
if 0: | ||
#>ERROR Import statement can only appear directly at scope level. | ||
# line 2, column 5 | ||
# 1 | if 0: | ||
# 2 | import math | ||
# : ^^^^^^^^^^^ | ||
import math |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
def f(): | ||
if 0: | ||
#>ERROR Import statement can only appear directly at scope level. | ||
# line 3, column 9 | ||
# 2 | if 0: | ||
# 3 | import this | ||
# : ^^^^^^^^^^^ | ||
import this |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
for i in range(10): | ||
if i % 2 == 0: | ||
#>ERROR Import statement can only appear directly at scope level. | ||
# line 3, column 9 | ||
# 2 | if i % 2 == 0: | ||
# 3 | from math import sin | ||
# : ^^^^^^^^^^^^^^^^^^^^ | ||
from math import sin |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if "beans": | ||
#>ERROR Macro definition can only appear directly at scope level. | ||
# line 2, column 5 | ||
# 1 | if "beans": | ||
# 2 | macro beans: | ||
# : ^^^^^^^^^^^ | ||
# 3 | pass | ||
macro beans: | ||
pass |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
for bean in "beans": | ||
if bean: | ||
#>ERROR Macro definition can only appear directly at scope level. | ||
# line 3, column 9 | ||
# 2 | if bean: | ||
# 3 | macro jelly bean(stream): | ||
# : ^^^^^^^^^^^ | ||
# 4 | pass | ||
macro jelly bean(stream): | ||
pass |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class A: | ||
#>ERROR Macro definition can only appear directly at scope level. | ||
# line 2, column 5 | ||
# 1 | class A: | ||
# 2 | macro foo: | ||
# : ^^^^^^^^^ | ||
# 3 | pass | ||
macro foo: | ||
pass |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class B: | ||
#>ERROR Import statement can only appear directly at scope level. | ||
# line 2, column 5 | ||
# 1 | class B: | ||
# 2 | import math | ||
# : ^^^^^^^^^^^ | ||
import math |