-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When running the following example script
@move
def foo_move():
init.fill([spec.get_static_trap(zone_id="traps")])
for _ in range(3):
zone = spec.get_static_trap(zone_id="traps")
src = grid.sub_grid(zone, [-1], [3])
dst = grid.sub_grid(zone, [15], [7])
waypoints = ilist.IList([src, dst])
move_by_waypoints(waypoints, True, True)This raises an error
ValidationError: for loop body must terminate with a yield or return when verifying the following statement `scf.For` at
scf.for %_ in %5 {
%zone = qourier.spec.get_static_trap(){zone_id='traps' : !py.str} : !py.Grid[!Any, !Any]
%7 = py.constant.constant 1 : !py.int
%8 = py.unary.usub(%7) : ~T
%9 = py.ilist.new(values=(%8)){elem_type=~T} : !py.IList[~T, Literal(1,int)]
%10 = py.constant.constant 3 : !py.int
%11 = py.ilist.new(values=(%10)){elem_type=!py.int} : !py.IList[!py.int, Literal(1,int)]
%src = grid.get_sub_grid(zone=%zone, x_indices=%9, y_indices=%11) : !py.Grid[~GetNumX, ~GetNumY]
%12 = py.constant.constant 15 : !py.int
%13 = py.ilist.new(values=(%12)){elem_type=!py.int} : !py.IList[!py.int, Literal(1,int)]
%14 = py.constant.constant 7 : !py.int
%15 = py.ilist.new(values=(%14)){elem_type=!py.int} : !py.IList[!py.int, Literal(1,int)]
%dst = grid.get_sub_grid(zone=%zone, x_indices=%13, y_indices=%15) : !py.Grid[~GetNumX, ~GetNumY]
%waypoints = py.ilist.new(values=(%src, %dst)){elem_type=!py.Grid[~GetNumX, ~GetNumY]} : !py.IList[!py.Grid[~GetNumX, ~GetNumY], Literal(2,int)]
%16 = py.constant.constant True : !py.bool
%17 = func.invoke move_by_waypoints(%waypoints, %16, %16) : !py.NoneType maybe_pure=False
} -> purity=False
Source Traceback:
File "/Users/jwurtz/Documents/Python/aist_hypercube_moves.py", line 104, col 43
│ dst = grid.sub_grid(zone, [15], [7])
│ waypoints = ilist.IList()
104│ move_by_waypoints(waypoints, True, True)
Note that if the waypoint calculations are put outside the loop, there is no error
@move
def foo_move():
init.fill([spec.get_static_trap(zone_id="traps")])
zone = spec.get_static_trap(zone_id="traps")
src = grid.sub_grid(zone, [-1], [3])
dst = grid.sub_grid(zone, [15], [7])
waypoints = ilist.IList([src, dst])
for _ in range(3):
move_by_waypoints(waypoints, True, True)Metadata
Metadata
Assignees
Labels
No labels