mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 04:30:24 +01:00
py/parse: Remove unnecessary check in const folding for ** operator.
In this part of the code there is no way to get the ** operator, so no need to check for it. This commit also adds tests for this, and other related, invalid const operations.
This commit is contained in:
@@ -15,3 +15,12 @@ test_syntax("a = const(x)")
|
||||
|
||||
# redefined constant
|
||||
test_syntax("A = const(1); A = const(2)")
|
||||
|
||||
# these operations are not supported within const
|
||||
test_syntax("A = const(1 @ 2)")
|
||||
test_syntax("A = const(1 / 2)")
|
||||
test_syntax("A = const(1 ** 2)")
|
||||
test_syntax("A = const(1 << -2)")
|
||||
test_syntax("A = const(1 >> -2)")
|
||||
test_syntax("A = const(1 % 0)")
|
||||
test_syntax("A = const(1 // 0)")
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
SyntaxError
|
||||
|
||||
Reference in New Issue
Block a user