diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index 6694b6129..37de32532 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -412,9 +412,13 @@ class Inferencer(algorithm.Visitor): if len(node.args) == 0 and len(node.keywords) == 0: pass # 0 + elif len(node.args) == 1 and len(node.keywords) == 0 and \ + types.is_var(node.args[0].type): + pass # undetermined yet elif len(node.args) == 1 and len(node.keywords) == 0 and \ builtins.is_numeric(node.args[0].type): - pass + self._unify(node.type, builtins.TInt(), + node.loc, None) elif len(node.args) == 1 and len(node.keywords) == 1 and \ builtins.is_numeric(node.args[0].type) and \ node.keywords[0].arg == 'width': @@ -441,6 +445,9 @@ class Inferencer(algorithm.Visitor): if len(node.args) == 0 and len(node.keywords) == 0: pass # 0.0 + elif len(node.args) == 1 and len(node.keywords) == 0 and \ + types.is_var(node.args[0].type): + pass # undetermined yet elif len(node.args) == 1 and len(node.keywords) == 0 and \ builtins.is_numeric(node.args[0].type): pass @@ -462,6 +469,8 @@ class Inferencer(algorithm.Visitor): if builtins.is_iterable(arg.type): pass + elif types.is_var(arg.type): + pass # undetermined yet else: note = diagnostic.Diagnostic("note", "this expression has type {type}", @@ -489,7 +498,11 @@ class Inferencer(algorithm.Visitor): self._unify(arg.type, range_tvar, arg.loc, None) - if not builtins.is_numeric(arg.type): + if builtins.is_numeric(arg.type): + pass + elif types.is_var(arg.type): + pass # undetermined yet + else: note = diagnostic.Diagnostic("note", "this expression has type {type}", {"type": types.TypePrinter().name(arg.type)}, @@ -514,6 +527,8 @@ class Inferencer(algorithm.Visitor): if builtins.is_iterable(arg.type): pass + elif types.is_var(arg.type): + pass # undetermined yet else: note = diagnostic.Diagnostic("note", "this expression has type {type}",