diff --git a/artiq/py2llvm/ast_body.py b/artiq/py2llvm/ast_body.py index 306ffb821..3cba3a976 100644 --- a/artiq/py2llvm/ast_body.py +++ b/artiq/py2llvm/ast_body.py @@ -200,7 +200,7 @@ class Visitor: for elt in elts[1:]: el_type.merge(elt) else: - el_type = VNone() + el_type = base_types.VNone() count = len(elts) r = lists.VList(el_type, count) r.elts = elts diff --git a/artiq/py2llvm/lists.py b/artiq/py2llvm/lists.py index 14e59622d..ded97773e 100644 --- a/artiq/py2llvm/lists.py +++ b/artiq/py2llvm/lists.py @@ -30,7 +30,14 @@ class VList(VGeneric): def merge(self, other): if isinstance(other, VList): - self.el_type.merge(other.el_type) + if self.alloc_count: + if other.alloc_count: + self.el_type.merge(other.el_type) + if self.alloc_count < other.alloc_count: + self.alloc_count = other.alloc_count + else: + self.el_type = other.el_type.new() + self.alloc_count = other.alloc_count else: raise TypeError("Incompatible types: {} and {}" .format(repr(self), repr(other)))