Commit 62410bbe authored by Stefan Behnel's avatar Stefan Behnel

some more type inference tests

parent e1f1152a
...@@ -62,6 +62,15 @@ def cascade(): ...@@ -62,6 +62,15 @@ def cascade():
e = a + b + c + d e = a + b + c + d
assert typeof(e) == "double" assert typeof(e) == "double"
def cascaded_assignment():
a = b = c = d = 1.0
assert typeof(a) == "double"
assert typeof(b) == "double"
assert typeof(c) == "double"
assert typeof(d) == "double"
e = a + b + c + d
assert typeof(e) == "double"
def increment(): def increment():
a = 5 a = 5
a += 1 a += 1
...@@ -71,10 +80,16 @@ def loop(): ...@@ -71,10 +80,16 @@ def loop():
for a in range(10): for a in range(10):
pass pass
assert typeof(a) == "long" assert typeof(a) == "long"
b = 1.0 b = 1.0
for b in range(5): for b in range(5):
pass pass
assert typeof(b) == "double" assert typeof(b) == "double"
for c from 0 <= c < 10 by .5: for c from 0 <= c < 10 by .5:
pass pass
assert typeof(c) == "double" assert typeof(c) == "double"
for d in range(0, 10L, 2):
pass
assert typeof(a) == "long"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment