transforms.inferencer: infer a monomorphic type for slice ":"

This commit is contained in:
whitequark 2016-01-16 03:09:03 +00:00
parent be560dbc63
commit cc22837627
2 changed files with 16 additions and 6 deletions

View File

@ -202,6 +202,10 @@ class Inferencer(algorithm.Visitor):
value.loc, None)
def visit_SliceT(self, node):
if (node.lower, node.upper, node.step) == (None, None, None):
self._unify(node.type, builtins.TInt32(),
node.loc, None)
else:
self._unify(node.type, builtins.TInt(),
node.loc, None)
for operand in (node.lower, node.upper, node.step):

View File

@ -0,0 +1,6 @@
# RUN: %python -m artiq.compiler.testbench.inferencer %s >%t
# RUN: OutputCheck %s --file-to-check=%t
x = [0]
# CHECK-L: [::int(width=32)]
x[:] = [1]