All for loops check that the loop variable has the right type. That's good.
List comprehensions do not check that the variable they dereference has the right type.
Example program:
def f(xs:List(Int)):
for x in xs:
pass
[x for x in xs]
return
The retic -p version does a check_type_int inside the for loop, but not inside the comprehension.
from retic.runtime import *
from retic.transient import *
from retic.typing import *
def f(xs):
check_type_list(xs)
for x in xs:
check_type_int(x)
pass
check_type_list([x for x in xs])
return
f = check_type_function(f)
All
forloops check that the loop variable has the right type. That's good.List comprehensions do not check that the variable they dereference has the right type.
Example program:
The
retic -pversion does acheck_type_intinside the for loop, but not inside the comprehension.