aboutsummaryrefslogtreecommitdiff
path: root/tests/basics
diff options
context:
space:
mode:
authorDamien George2020-04-07 12:23:08 +1000
committerDamien George2020-05-03 16:23:19 +1000
commit4ede70368722f4702320412f393a7c703cdf4276 (patch)
tree30615518e0a6d69c5bdd7e17b71816ee929348c6 /tests/basics
parent40e92277339697159e9ae120d814b64b6d4bbf04 (diff)
py/parse: Support constant folding of power operator for integers.
Constant expression like "2 ** 3" will now be folded, and the special form "X = const(2 ** 3)" will now compile because the argument to the const is now a constant. Fixes issue #5865.
Diffstat (limited to 'tests/basics')
-rw-r--r--tests/basics/int_constfolding.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/basics/int_constfolding.py b/tests/basics/int_constfolding.py
index 158897f55..3168685ff 100644
--- a/tests/basics/int_constfolding.py
+++ b/tests/basics/int_constfolding.py
@@ -30,6 +30,10 @@ print(-123 // 7, -123 % 7)
print(123 // -7, 123 % -7)
print(-123 // -7, -123 % -7)
+# power
+print(2 ** 3)
+print(3 ** 4)
+
# won't fold so an exception can be raised at runtime
try:
1 << -1