mirror of https://github.com/m-labs/artiq.git
transforms.inferencer: infer a monomorphic type for slice ":"
This commit is contained in:
parent
be560dbc63
commit
cc22837627
|
@ -202,12 +202,16 @@ class Inferencer(algorithm.Visitor):
|
||||||
value.loc, None)
|
value.loc, None)
|
||||||
|
|
||||||
def visit_SliceT(self, node):
|
def visit_SliceT(self, node):
|
||||||
self._unify(node.type, builtins.TInt(),
|
if (node.lower, node.upper, node.step) == (None, None, None):
|
||||||
node.loc, None)
|
self._unify(node.type, builtins.TInt32(),
|
||||||
for operand in (node.lower, node.upper, node.step):
|
node.loc, None)
|
||||||
if operand is not None:
|
else:
|
||||||
self._unify(operand.type, node.type,
|
self._unify(node.type, builtins.TInt(),
|
||||||
operand.loc, None)
|
node.loc, None)
|
||||||
|
for operand in (node.lower, node.upper, node.step):
|
||||||
|
if operand is not None:
|
||||||
|
self._unify(operand.type, node.type,
|
||||||
|
operand.loc, None)
|
||||||
|
|
||||||
def visit_ExtSlice(self, node):
|
def visit_ExtSlice(self, node):
|
||||||
diag = diagnostic.Diagnostic("error",
|
diag = diagnostic.Diagnostic("error",
|
||||||
|
|
|
@ -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]
|
Loading…
Reference in New Issue