From fa71b40c8039a14e3e84d440ee191b30ade1bb9e Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 6 Jul 2016 04:03:54 +0000 Subject: [PATCH] compiler: print the builtin type int(width=...) as np.int... --- artiq/compiler/builtins.py | 9 +++++- artiq/compiler/transforms/inferencer.py | 20 ++++++------- artiq/compiler/types.py | 6 +++- .../test/lit/embedding/error_attr_conflict.py | 2 +- artiq/test/lit/embedding/error_attr_unify.py | 2 +- artiq/test/lit/inferencer/builtin_calls.py | 16 +++++------ artiq/test/lit/inferencer/class.py | 8 +++--- artiq/test/lit/inferencer/coerce.py | 26 ++++++++--------- artiq/test/lit/inferencer/error_call.py | 2 +- artiq/test/lit/inferencer/error_coerce.py | 18 ++++++------ artiq/test/lit/inferencer/error_exception.py | 2 +- artiq/test/lit/inferencer/error_iterable.py | 2 +- artiq/test/lit/inferencer/error_method.py | 2 +- artiq/test/lit/inferencer/error_return.py | 10 +++---- artiq/test/lit/inferencer/error_unify.py | 14 +++++----- artiq/test/lit/inferencer/error_with_exn.py | 4 +-- artiq/test/lit/inferencer/error_with_self.py | 4 +-- artiq/test/lit/inferencer/gcd.py | 2 +- artiq/test/lit/inferencer/prelude.py | 2 +- artiq/test/lit/inferencer/scoping.py | 2 +- artiq/test/lit/inferencer/slice.py | 2 +- artiq/test/lit/inferencer/unify.py | 28 +++++++++---------- artiq/test/lit/iodelay/argument.py | 2 +- artiq/test/lit/iodelay/arith.py | 2 +- artiq/test/lit/iodelay/interleave.py | 4 +-- artiq/test/lit/iodelay/range.py | 6 ++-- artiq/test/lit/iodelay/return.py | 4 +-- artiq/test/lit/iodelay/sequential.py | 2 +- artiq/test/lit/monomorphism/integers.py | 6 ++-- 29 files changed, 110 insertions(+), 99 deletions(-) diff --git a/artiq/compiler/builtins.py b/artiq/compiler/builtins.py index baef12797..77703ed3c 100644 --- a/artiq/compiler/builtins.py +++ b/artiq/compiler/builtins.py @@ -44,6 +44,13 @@ def TInt32(): def TInt64(): return TInt(types.TValue(64)) +def _int_printer(typ, depth, max_depth): + if types.is_var(typ["width"]): + return "numpy.int?" + else: + return "numpy.int{}".format(types.get_value(typ.find()["width"])) +types.TypePrinter.custom_printers['int'] = _int_printer + class TFloat(types.TMono): def __init__(self): super().__init__("float") @@ -83,7 +90,7 @@ class TException(types.TMono): # (which also serves as the EHABI type_info). # * File, line and column where it was raised (str, int, int). # * Message, which can contain substitutions {0}, {1} and {2} (str). - # * Three 64-bit integers, parameterizing the message (int(width=64)). + # * Three 64-bit integers, parameterizing the message (numpy.int64). # Keep this in sync with the function ARTIQIRGenerator.alloc_exn. attributes = OrderedDict([ diff --git a/artiq/compiler/transforms/inferencer.py b/artiq/compiler/transforms/inferencer.py index 59d215c84..56eeeb9a0 100644 --- a/artiq/compiler/transforms/inferencer.py +++ b/artiq/compiler/transforms/inferencer.py @@ -579,11 +579,11 @@ class Inferencer(algorithm.Visitor): valid_forms = lambda: [ valid_form("{exn}() -> {exn}".format(exn=typ.name)), valid_form("{exn}(message:str) -> {exn}".format(exn=typ.name)), - valid_form("{exn}(message:str, param1:int(width=64)) -> {exn}".format(exn=typ.name)), - valid_form("{exn}(message:str, param1:int(width=64), " - "param2:int(width=64)) -> {exn}".format(exn=typ.name)), - valid_form("{exn}(message:str, param1:int(width=64), " - "param2:int(width=64), param3:int(width=64)) " + valid_form("{exn}(message:str, param1:numpy.int64) -> {exn}".format(exn=typ.name)), + valid_form("{exn}(message:str, param1:numpy.int64, " + "param2:numpy.int64) -> {exn}".format(exn=typ.name)), + valid_form("{exn}(message:str, param1:numpy.int64, " + "param2:numpy.int64, param3:numpy.int64) " "-> {exn}".format(exn=typ.name)), ] @@ -858,19 +858,19 @@ class Inferencer(algorithm.Visitor): simple_form("at(time:float) -> None", [builtins.TFloat()]) elif types.is_builtin(typ, "now_mu"): - simple_form("now_mu() -> int(width=64)", + simple_form("now_mu() -> numpy.int64", [], builtins.TInt64()) elif types.is_builtin(typ, "delay_mu"): - simple_form("delay_mu(time_mu:int(width=64)) -> None", + simple_form("delay_mu(time_mu:numpy.int64) -> None", [builtins.TInt64()]) elif types.is_builtin(typ, "at_mu"): - simple_form("at_mu(time_mu:int(width=64)) -> None", + simple_form("at_mu(time_mu:numpy.int64) -> None", [builtins.TInt64()]) elif types.is_builtin(typ, "mu_to_seconds"): - simple_form("mu_to_seconds(time_mu:int(width=64)) -> float", + simple_form("mu_to_seconds(time_mu:numpy.int64) -> float", [builtins.TInt64()], builtins.TFloat()) elif types.is_builtin(typ, "seconds_to_mu"): - simple_form("seconds_to_mu(time:float) -> int(width=64)", + simple_form("seconds_to_mu(time:float) -> numpy.int64", [builtins.TFloat()], builtins.TInt64()) elif types.is_builtin(typ, "watchdog"): simple_form("watchdog(time:float) -> [builtin context manager]", diff --git a/artiq/compiler/types.py b/artiq/compiler/types.py index ac1e9377c..04ba46f75 100644 --- a/artiq/compiler/types.py +++ b/artiq/compiler/types.py @@ -670,6 +670,8 @@ class TypePrinter(object): type variables sequential alphabetic names. """ + custom_printers = {} + def __init__(self): self.gen = genalnum() self.map = {} @@ -694,7 +696,9 @@ class TypePrinter(object): self.recurse_guard.add(typ) return "".format(typ.name) elif isinstance(typ, TMono): - if typ.params == {}: + if typ.name in self.custom_printers: + return self.custom_printers[typ.name](typ, depth + 1, max_depth) + elif typ.params == {}: return typ.name else: return "%s(%s)" % (typ.name, ", ".join( diff --git a/artiq/test/lit/embedding/error_attr_conflict.py b/artiq/test/lit/embedding/error_attr_conflict.py index e38d45fba..a8556dd2c 100644 --- a/artiq/test/lit/embedding/error_attr_conflict.py +++ b/artiq/test/lit/embedding/error_attr_conflict.py @@ -15,7 +15,7 @@ i2.x = 1.0 @kernel def entrypoint(): - # CHECK-L: :1: error: host object has an attribute 'x' of type float, which is different from previously inferred type int(width=32) for the same attribute + # CHECK-L: :1: error: host object has an attribute 'x' of type float, which is different from previously inferred type numpy.int32 for the same attribute i1.x # CHECK-L: ${LINE:+1}: note: expanded from here i2.x diff --git a/artiq/test/lit/embedding/error_attr_unify.py b/artiq/test/lit/embedding/error_attr_unify.py index b677d2822..c8f6321a8 100644 --- a/artiq/test/lit/embedding/error_attr_unify.py +++ b/artiq/test/lit/embedding/error_attr_unify.py @@ -9,7 +9,7 @@ class c: @kernel def entrypoint(): - # CHECK-L: :1: error: cannot unify int(width='a) with str + # CHECK-L: :1: error: cannot unify numpy.int? with str # CHECK-NEXT-L: [1, 'x'] # CHECK-L: ${LINE:+1}: note: expanded from here a = c diff --git a/artiq/test/lit/inferencer/builtin_calls.py b/artiq/test/lit/inferencer/builtin_calls.py index 1b3157e2e..c461d5a03 100644 --- a/artiq/test/lit/inferencer/builtin_calls.py +++ b/artiq/test/lit/inferencer/builtin_calls.py @@ -7,29 +7,29 @@ bool() # CHECK-L: bool:([]:list(elt='a)):bool bool([]) -# CHECK-L: int:():int(width='b) +# CHECK-L: int:():numpy.int? int() -# CHECK-L: int:(1.0:float):int(width='c) +# CHECK-L: int:(1.0:float):numpy.int? int(1.0) -# CHECK-L: int:(1.0:float, width=64:int(width='d)):int(width=64) +# CHECK-L: int:(1.0:float, width=64:numpy.int?):numpy.int64 int(1.0, width=64) # CHECK-L: float:():float float() -# CHECK-L: float:(1:int(width='e)):float +# CHECK-L: float:(1:numpy.int?):float float(1) -# CHECK-L: list:():list(elt='f) +# CHECK-L: list:():list(elt='b) list() -# CHECK-L: len:([]:list(elt='g)):int(width=32) +# CHECK-L: len:([]:list(elt='c)):numpy.int32 len([]) -# CHECK-L: round:(1.0:float):int(width='h) +# CHECK-L: round:(1.0:float):numpy.int? round(1.0) -# CHECK-L: round:(1.0:float, width=64:int(width='i)):int(width=64) +# CHECK-L: round:(1.0:float, width=64:numpy.int?):numpy.int64 round(1.0, width=64) diff --git a/artiq/test/lit/inferencer/class.py b/artiq/test/lit/inferencer/class.py index 1249474a0..4e26b7c58 100644 --- a/artiq/test/lit/inferencer/class.py +++ b/artiq/test/lit/inferencer/class.py @@ -8,12 +8,12 @@ class c: def m(self): pass -# CHECK-L: c:)->NoneType delay('c)}> +# CHECK-L: c:NoneType delay('a), m: (self:)->NoneType delay('b)}> c -# CHECK-L: .a:int(width='a) +# CHECK-L: .a:numpy.int? c.a -# CHECK-L: .f:()->NoneType delay('b) +# CHECK-L: .f:()->NoneType delay('a) c.f -# CHECK-L: .m:method(fn=(self:)->NoneType delay('c), self=) +# CHECK-L: .m:method(fn=(self:)->NoneType delay('b), self=) c().m() diff --git a/artiq/test/lit/inferencer/coerce.py b/artiq/test/lit/inferencer/coerce.py index 04fe42bbc..714bf6ad0 100644 --- a/artiq/test/lit/inferencer/coerce.py +++ b/artiq/test/lit/inferencer/coerce.py @@ -2,40 +2,40 @@ # RUN: OutputCheck %s --file-to-check=%t 1 | 2 -# CHECK-L: 1:int(width='a):int(width='b) | 2:int(width='c):int(width='b):int(width='b) +# CHECK-L: 1:numpy.int?:numpy.int? | 2:numpy.int?:numpy.int?:numpy.int? 1 + 2 -# CHECK-L: 1:int(width='d):int(width='e) + 2:int(width='f):int(width='e):int(width='e) +# CHECK-L: 1:numpy.int?:numpy.int? + 2:numpy.int?:numpy.int?:numpy.int? (1,) + (2.0,) -# CHECK-L: (1:int(width='g),):(int(width='g),) + (2.0:float,):(float,):(int(width='g), float) +# CHECK-L: (1:numpy.int?,):(numpy.int?,) + (2.0:float,):(float,):(numpy.int?, float) [1] + [2] -# CHECK-L: [1:int(width='h)]:list(elt=int(width='h)) + [2:int(width='h)]:list(elt=int(width='h)):list(elt=int(width='h)) +# CHECK-L: [1:numpy.int?]:list(elt=numpy.int?) + [2:numpy.int?]:list(elt=numpy.int?):list(elt=numpy.int?) 1 * 2 -# CHECK-L: 1:int(width='i):int(width='j) * 2:int(width='k):int(width='j):int(width='j) +# CHECK-L: 1:numpy.int?:numpy.int? * 2:numpy.int?:numpy.int?:numpy.int? [1] * 2 -# CHECK-L: [1:int(width='l)]:list(elt=int(width='l)) * 2:int(width='m):list(elt=int(width='l)) +# CHECK-L: [1:numpy.int?]:list(elt=numpy.int?) * 2:numpy.int?:list(elt=numpy.int?) 1 // 2 -# CHECK-L: 1:int(width='n):int(width='o) // 2:int(width='p):int(width='o):int(width='o) +# CHECK-L: 1:numpy.int?:numpy.int? // 2:numpy.int?:numpy.int?:numpy.int? 1 + 1.0 -# CHECK-L: 1:int(width='q):float + 1.0:float:float +# CHECK-L: 1:numpy.int?:float + 1.0:float:float a = []; a += [1] -# CHECK-L: a:list(elt=int(width='r)) = []:list(elt=int(width='r)); a:list(elt=int(width='r)) += [1:int(width='r)]:list(elt=int(width='r)) +# CHECK-L: a:list(elt=numpy.int?) = []:list(elt=numpy.int?); a:list(elt=numpy.int?) += [1:numpy.int?]:list(elt=numpy.int?) [] is [1] -# CHECK-L: []:list(elt=int(width='s)) is [1:int(width='s)]:list(elt=int(width='s)):bool +# CHECK-L: []:list(elt=numpy.int?) is [1:numpy.int?]:list(elt=numpy.int?):bool 1 in [1] -# CHECK-L: 1:int(width='t) in [1:int(width='t)]:list(elt=int(width='t)):bool +# CHECK-L: 1:numpy.int? in [1:numpy.int?]:list(elt=numpy.int?):bool [] < [1] -# CHECK-L: []:list(elt=int(width='u)) < [1:int(width='u)]:list(elt=int(width='u)):bool +# CHECK-L: []:list(elt=numpy.int?) < [1:numpy.int?]:list(elt=numpy.int?):bool 1.0 < 1 -# CHECK-L: 1.0:float < 1:int(width='v):float:bool +# CHECK-L: 1.0:float < 1:numpy.int?:float:bool diff --git a/artiq/test/lit/inferencer/error_call.py b/artiq/test/lit/inferencer/error_call.py index 739ffa249..1c3df3a6a 100644 --- a/artiq/test/lit/inferencer/error_call.py +++ b/artiq/test/lit/inferencer/error_call.py @@ -1,7 +1,7 @@ # RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: ${LINE:+1}: error: cannot call this expression of type int +# CHECK-L: ${LINE:+1}: error: cannot call this expression of type numpy.int? (1)() def f(x, y, z=1): diff --git a/artiq/test/lit/inferencer/error_coerce.py b/artiq/test/lit/inferencer/error_coerce.py index bf4a5dd36..8afb83e6b 100644 --- a/artiq/test/lit/inferencer/error_coerce.py +++ b/artiq/test/lit/inferencer/error_coerce.py @@ -5,33 +5,33 @@ 1 << 2.0 # CHECK-L: ${LINE:+3}: error: expected every '+' operand to be a list in this context -# CHECK-L: ${LINE:+2}: note: list of type list(elt=int(width='a)) -# CHECK-L: ${LINE:+1}: note: int(width='b), which cannot be added to a list +# CHECK-L: ${LINE:+2}: note: list of type list(elt=numpy.int?) +# CHECK-L: ${LINE:+1}: note: numpy.int?, which cannot be added to a list [1] + 2 -# CHECK-L: ${LINE:+1}: error: cannot unify list(elt=int(width='a)) with list(elt=float): int(width='a) is incompatible with float +# CHECK-L: ${LINE:+1}: error: cannot unify list(elt=numpy.int?) with list(elt=float): numpy.int? is incompatible with float [1] + [2.0] # CHECK-L: ${LINE:+3}: error: expected every '+' operand to be a tuple in this context -# CHECK-L: ${LINE:+2}: note: tuple of type (int(width='a),) -# CHECK-L: ${LINE:+1}: note: int(width='b), which cannot be added to a tuple +# CHECK-L: ${LINE:+2}: note: tuple of type (numpy.int?,) +# CHECK-L: ${LINE:+1}: note: numpy.int?, which cannot be added to a tuple (1,) + 2 # CHECK-L: ${LINE:+1}: error: passing tuples to '*' is not supported (1,) * 2 # CHECK-L: ${LINE:+3}: error: expected '*' operands to be a list and an integer in this context -# CHECK-L: ${LINE:+2}: note: list operand of type list(elt=int(width='a)) -# CHECK-L: ${LINE:+1}: note: operand of type list(elt='b), which is not a valid repetition amount +# CHECK-L: ${LINE:+2}: note: list operand of type list(elt=numpy.int?) +# CHECK-L: ${LINE:+1}: note: operand of type list(elt='a), which is not a valid repetition amount [1] * [] # CHECK-L: ${LINE:+1}: error: cannot coerce list(elt='a) to a numeric type [] - 1.0 -# CHECK-L: ${LINE:+2}: error: expression of type int(width='a) has to be coerced to float, which makes assignment invalid +# CHECK-L: ${LINE:+2}: error: expression of type numpy.int? has to be coerced to float, which makes assignment invalid # CHECK-L: ${LINE:+1}: note: expression of type float a = 1; a += 1.0 -# CHECK-L: ${LINE:+2}: error: the result of this operation has type (int(width='a), float), which makes assignment to a slot of type (int(width='a),) invalid +# CHECK-L: ${LINE:+2}: error: the result of this operation has type (numpy.int?, float), which makes assignment to a slot of type (numpy.int?,) invalid # CHECK-L: ${LINE:+1}: note: expression of type (float,) b = (1,); b += (1.0,) diff --git a/artiq/test/lit/inferencer/error_exception.py b/artiq/test/lit/inferencer/error_exception.py index 4e4b340b5..ee049bb2a 100644 --- a/artiq/test/lit/inferencer/error_exception.py +++ b/artiq/test/lit/inferencer/error_exception.py @@ -9,6 +9,6 @@ except 1: try: pass -# CHECK-L: ${LINE:+1}: error: cannot unify int(width='a) with Exception +# CHECK-L: ${LINE:+1}: error: cannot unify numpy.int? with Exception except Exception as e: e = 1 diff --git a/artiq/test/lit/inferencer/error_iterable.py b/artiq/test/lit/inferencer/error_iterable.py index 68ed1b002..73afa2fcc 100644 --- a/artiq/test/lit/inferencer/error_iterable.py +++ b/artiq/test/lit/inferencer/error_iterable.py @@ -1,5 +1,5 @@ # RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: ${LINE:+1}: error: type int(width='a) is not iterable +# CHECK-L: ${LINE:+1}: error: type numpy.int? is not iterable for x in 1: pass diff --git a/artiq/test/lit/inferencer/error_method.py b/artiq/test/lit/inferencer/error_method.py index cb4f77075..2f4d1d3fe 100644 --- a/artiq/test/lit/inferencer/error_method.py +++ b/artiq/test/lit/inferencer/error_method.py @@ -12,5 +12,5 @@ class c: c().f() c.g(1) -# CHECK-L: ${LINE:+1}: error: cannot unify with int(width='a) while inferring the type for self argument +# CHECK-L: ${LINE:+1}: error: cannot unify with numpy.int? while inferring the type for self argument c().g() diff --git a/artiq/test/lit/inferencer/error_return.py b/artiq/test/lit/inferencer/error_return.py index ba4ddc2b3..40e6fd889 100644 --- a/artiq/test/lit/inferencer/error_return.py +++ b/artiq/test/lit/inferencer/error_return.py @@ -1,16 +1,16 @@ # RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: ${LINE:+2}: error: cannot unify int(width='a) with NoneType -# CHECK-L: ${LINE:+1}: note: function with return type int(width='a) +# CHECK-L: ${LINE:+2}: error: cannot unify numpy.int? with NoneType +# CHECK-L: ${LINE:+1}: note: function with return type numpy.int? def a(): return 1 # CHECK-L: ${LINE:+1}: note: a statement returning NoneType return -# CHECK-L: ${LINE:+2}: error: cannot unify int(width='a) with list(elt='b) -# CHECK-L: ${LINE:+1}: note: function with return type int(width='a) +# CHECK-L: ${LINE:+2}: error: cannot unify numpy.int? with list(elt='a) +# CHECK-L: ${LINE:+1}: note: function with return type numpy.int? def b(): return 1 - # CHECK-L: ${LINE:+1}: note: a statement returning list(elt='b) + # CHECK-L: ${LINE:+1}: note: a statement returning list(elt='a) return [] diff --git a/artiq/test/lit/inferencer/error_unify.py b/artiq/test/lit/inferencer/error_unify.py index e81537d29..636d4f85a 100644 --- a/artiq/test/lit/inferencer/error_unify.py +++ b/artiq/test/lit/inferencer/error_unify.py @@ -4,17 +4,17 @@ a = 1 b = [] -# CHECK-L: ${LINE:+1}: error: cannot unify int(width='a) with list(elt='b) +# CHECK-L: ${LINE:+1}: error: cannot unify numpy.int? with list(elt='a) a = b -# CHECK-L: ${LINE:+1}: error: cannot unify int(width='a) with list(elt='b) +# CHECK-L: ${LINE:+1}: error: cannot unify numpy.int? with list(elt='a) [1, []] -# CHECK-L: note: a list element of type int(width='a) -# CHECK-L: note: a list element of type list(elt='b) +# CHECK-L: note: a list element of type numpy.int? +# CHECK-L: note: a list element of type list(elt='a) -# CHECK-L: ${LINE:+1}: error: cannot unify int(width='a) with bool +# CHECK-L: ${LINE:+1}: error: cannot unify numpy.int? with bool 1 and False -# CHECK-L: note: an operand of type int(width='a) +# CHECK-L: note: an operand of type numpy.int? # CHECK-L: note: an operand of type bool # CHECK-L: ${LINE:+1}: error: expected unary '+' operand to be of numeric type, not list(elt='a) @@ -23,5 +23,5 @@ a = b # CHECK-L: ${LINE:+1}: error: expected '~' operand to be of integer type, not float ~1.0 -# CHECK-L: ${LINE:+1}: error: type int(width='a) does not have an attribute 'x' +# CHECK-L: ${LINE:+1}: error: type numpy.int? does not have an attribute 'x' (1).x diff --git a/artiq/test/lit/inferencer/error_with_exn.py b/artiq/test/lit/inferencer/error_with_exn.py index 27d6b1b54..283dadb5a 100644 --- a/artiq/test/lit/inferencer/error_with_exn.py +++ b/artiq/test/lit/inferencer/error_with_exn.py @@ -10,7 +10,7 @@ class contextmgr: pass def foo(): - # CHECK-L: ${LINE:+2}: error: cannot unify int(width='a) with NoneType - # CHECK-L: ${LINE:+1}: note: exception handling via context managers is not supported; the argument 'n3' of function '__exit__(self:, n1:NoneType, n2:NoneType, n3:int(width='a))->NoneType delay('b)' will always be None + # CHECK-L: ${LINE:+2}: error: cannot unify numpy.int? with NoneType + # CHECK-L: ${LINE:+1}: note: exception handling via context managers is not supported; the argument 'n3' of function '__exit__(self:, n1:NoneType, n2:NoneType, n3:numpy.int?)->NoneType delay('a)' will always be None with contextmgr(): pass diff --git a/artiq/test/lit/inferencer/error_with_self.py b/artiq/test/lit/inferencer/error_with_self.py index afe53e531..d22c5c085 100644 --- a/artiq/test/lit/inferencer/error_with_self.py +++ b/artiq/test/lit/inferencer/error_with_self.py @@ -10,8 +10,8 @@ class contextmgr: def foo(): contextmgr.__enter__(1) - # CHECK-L: ${LINE:+3}: error: cannot unify with int(width='a) while inferring the type for self argument + # CHECK-L: ${LINE:+3}: error: cannot unify with numpy.int? while inferring the type for self argument # CHECK-L: ${LINE:+2}: note: expression of type - # CHECK-L: ${LINE:+1}: note: reference to an instance with a method '__enter__(self:int(width='a))->NoneType delay('b)' + # CHECK-L: ${LINE:+1}: note: reference to an instance with a method '__enter__(self:numpy.int?)->NoneType delay('a)' with contextmgr(): pass diff --git a/artiq/test/lit/inferencer/gcd.py b/artiq/test/lit/inferencer/gcd.py index e2d4b4779..3137d7cc0 100644 --- a/artiq/test/lit/inferencer/gcd.py +++ b/artiq/test/lit/inferencer/gcd.py @@ -9,5 +9,5 @@ def _gcd(a, b): b = c return b -# CHECK-L: _gcd:(a:int(width='a), b:int(width='a))->int(width='a)(10:int(width='a), 25:int(width='a)):int(width='a) +# CHECK-L: _gcd:(a:numpy.int?, b:numpy.int?)->numpy.int?(10:numpy.int?, 25:numpy.int?):numpy.int? _gcd(10, 25) diff --git a/artiq/test/lit/inferencer/prelude.py b/artiq/test/lit/inferencer/prelude.py index 643895e4a..288cc78b3 100644 --- a/artiq/test/lit/inferencer/prelude.py +++ b/artiq/test/lit/inferencer/prelude.py @@ -6,5 +6,5 @@ x = len def f(): global len - # CHECK-L: len:int(width='a) = + # CHECK-L: len:numpy.int? = len = 1 diff --git a/artiq/test/lit/inferencer/scoping.py b/artiq/test/lit/inferencer/scoping.py index 604b2425d..9847ef0ea 100644 --- a/artiq/test/lit/inferencer/scoping.py +++ b/artiq/test/lit/inferencer/scoping.py @@ -1,7 +1,7 @@ # RUN: %python -m artiq.compiler.testbench.inferencer %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: []:list(elt=int(width='a)) +# CHECK-L: []:list(elt=numpy.int?) x = [] def f(): diff --git a/artiq/test/lit/inferencer/slice.py b/artiq/test/lit/inferencer/slice.py index 1693bcd85..610fa9dc3 100644 --- a/artiq/test/lit/inferencer/slice.py +++ b/artiq/test/lit/inferencer/slice.py @@ -2,5 +2,5 @@ # RUN: OutputCheck %s --file-to-check=%t x = [0] -# CHECK-L: [::int(width=32)] +# CHECK-L: [::numpy.int32] x[:] = [1] diff --git a/artiq/test/lit/inferencer/unify.py b/artiq/test/lit/inferencer/unify.py index 59d23e937..a0dadaf1e 100644 --- a/artiq/test/lit/inferencer/unify.py +++ b/artiq/test/lit/inferencer/unify.py @@ -2,10 +2,10 @@ # RUN: OutputCheck %s --file-to-check=%t a = 1 -# CHECK-L: a:int(width='a) +# CHECK-L: a:numpy.int? b = a -# CHECK-L: b:int(width='a) +# CHECK-L: b:numpy.int? c = True # CHECK-L: c:bool @@ -20,39 +20,39 @@ f = 1.0 # CHECK-L: f:float g = [] -# CHECK-L: g:list(elt='b) +# CHECK-L: g:list(elt='a) h = [1] -# CHECK-L: h:list(elt=int(width='c)) +# CHECK-L: h:list(elt=numpy.int?) i = [] i[0] = 1 -# CHECK-L: i:list(elt=int(width='d)) +# CHECK-L: i:list(elt=numpy.int?) j = [] j += [1.0] # CHECK-L: j:list(elt=float) 1 if a else 2 -# CHECK-L: 1:int(width='f) if a:int(width='a) else 2:int(width='f):int(width='f) +# CHECK-L: 1:numpy.int? if a:numpy.int? else 2:numpy.int?:numpy.int? True and False # CHECK-L: True:bool and False:bool:bool 1 and 0 -# CHECK-L: 1:int(width='g) and 0:int(width='g):int(width='g) +# CHECK-L: 1:numpy.int? and 0:numpy.int?:numpy.int? ~1 -# CHECK-L: 1:int(width='h):int(width='h) +# CHECK-L: 1:numpy.int?:numpy.int? not 1 -# CHECK-L: 1:int(width='i):bool +# CHECK-L: 1:numpy.int?:bool [x for x in [1]] -# CHECK-L: [x:int(width='j) for x:int(width='j) in [1:int(width='j)]:list(elt=int(width='j))]:list(elt=int(width='j)) +# CHECK-L: [x:numpy.int? for x:numpy.int? in [1:numpy.int?]:list(elt=numpy.int?)]:list(elt=numpy.int?) lambda x, y=1: x -# CHECK-L: lambda x:'k, y:int(width='l)=1:int(width='l): x:'k:(x:'k, ?y:int(width='l))->'k +# CHECK-L: lambda x:'b, y:numpy.int?=1:numpy.int?: x:'b:(x:'b, ?y:numpy.int?)->'b k = "x" # CHECK-L: k:str @@ -64,10 +64,10 @@ IndexError("x") # CHECK-L: IndexError:("x":str):IndexError IndexError("x", 1) -# CHECK-L: IndexError:("x":str, 1:int(width=64)):IndexError +# CHECK-L: IndexError:("x":str, 1:numpy.int64):IndexError IndexError("x", 1, 1) -# CHECK-L: IndexError:("x":str, 1:int(width=64), 1:int(width=64)):IndexError +# CHECK-L: IndexError:("x":str, 1:numpy.int64, 1:numpy.int64):IndexError IndexError("x", 1, 1, 1) -# CHECK-L: IndexError:("x":str, 1:int(width=64), 1:int(width=64), 1:int(width=64)):IndexError +# CHECK-L: IndexError:("x":str, 1:numpy.int64, 1:numpy.int64, 1:numpy.int64):IndexError diff --git a/artiq/test/lit/iodelay/argument.py b/artiq/test/lit/iodelay/argument.py index f026c78f1..94da1c764 100644 --- a/artiq/test/lit/iodelay/argument.py +++ b/artiq/test/lit/iodelay/argument.py @@ -1,7 +1,7 @@ # RUN: %python -m artiq.compiler.testbench.signature %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: f: (a:float, b:int(width=64))->NoneType delay(s->mu(a) + b mu) +# CHECK-L: f: (a:float, b:numpy.int64)->NoneType delay(s->mu(a) + b mu) def f(a, b): delay(a) delay_mu(b) diff --git a/artiq/test/lit/iodelay/arith.py b/artiq/test/lit/iodelay/arith.py index 0eba79715..05d42e666 100644 --- a/artiq/test/lit/iodelay/arith.py +++ b/artiq/test/lit/iodelay/arith.py @@ -1,7 +1,7 @@ # RUN: %python -m artiq.compiler.testbench.signature %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: f: (a:int(width=32), b:int(width=32), c:int(width=32), d:int(width=32), e:int(width=32))->NoneType delay(s->mu(a * b // c + d - 10 / e) mu) +# CHECK-L: f: (a:numpy.int32, b:numpy.int32, c:numpy.int32, d:numpy.int32, e:numpy.int32)->NoneType delay(s->mu(a * b // c + d - 10 / e) mu) def f(a, b, c, d, e): delay(a * b // c + d - 10 / e) diff --git a/artiq/test/lit/iodelay/interleave.py b/artiq/test/lit/iodelay/interleave.py index 598c572de..76e30b7a7 100644 --- a/artiq/test/lit/iodelay/interleave.py +++ b/artiq/test/lit/iodelay/interleave.py @@ -1,13 +1,13 @@ # RUN: %python -m artiq.compiler.testbench.signature %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: f: (a:int(width=64), b:int(width=64))->NoneType delay(max(a, b) mu) +# CHECK-L: f: (a:numpy.int64, b:numpy.int64)->NoneType delay(max(a, b) mu) def f(a, b): with interleave: delay_mu(a) delay_mu(b) -# CHECK-L: g: (a:int(width=64))->NoneType delay(max(a, 200) mu) +# CHECK-L: g: (a:numpy.int64)->NoneType delay(max(a, 200) mu) def g(a): with interleave: delay_mu(100) diff --git a/artiq/test/lit/iodelay/range.py b/artiq/test/lit/iodelay/range.py index 9c4a73a79..c5592927e 100644 --- a/artiq/test/lit/iodelay/range.py +++ b/artiq/test/lit/iodelay/range.py @@ -1,17 +1,17 @@ # RUN: %python -m artiq.compiler.testbench.signature %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: f: (a:int(width=32))->NoneType delay(3 * a mu) +# CHECK-L: f: (a:numpy.int32)->NoneType delay(3 * a mu) def f(a): for _ in range(a): delay_mu(3) -# CHECK-L: g: (a:int(width=32), b:int(width=32))->NoneType delay(3 * (b - a) mu) +# CHECK-L: g: (a:numpy.int32, b:numpy.int32)->NoneType delay(3 * (b - a) mu) def g(a, b): for _ in range(a, b): delay_mu(3) -# CHECK-L: h: (a:int(width=32), b:int(width=32), c:int(width=32))->NoneType delay(3 * (b - a) // c mu) +# CHECK-L: h: (a:numpy.int32, b:numpy.int32, c:numpy.int32)->NoneType delay(3 * (b - a) // c mu) def h(a, b, c): for _ in range(a, b, c): delay_mu(3) diff --git a/artiq/test/lit/iodelay/return.py b/artiq/test/lit/iodelay/return.py index d07267a44..9eefe1f54 100644 --- a/artiq/test/lit/iodelay/return.py +++ b/artiq/test/lit/iodelay/return.py @@ -1,13 +1,13 @@ # RUN: %python -m artiq.compiler.testbench.signature %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: f: ()->int(width=32) delay(30 mu) +# CHECK-L: f: ()->numpy.int32 delay(30 mu) def f(): for _ in range(10): delay_mu(3) return 10 -# CHECK-L: g: (x:float)->int(width=32) +# CHECK-L: g: (x:float)->numpy.int32 # CHECK-NOT-L: delay def g(x): if x > 1.0: diff --git a/artiq/test/lit/iodelay/sequential.py b/artiq/test/lit/iodelay/sequential.py index 54a776b68..5be751126 100644 --- a/artiq/test/lit/iodelay/sequential.py +++ b/artiq/test/lit/iodelay/sequential.py @@ -1,7 +1,7 @@ # RUN: %python -m artiq.compiler.testbench.signature %s >%t # RUN: OutputCheck %s --file-to-check=%t -# CHECK-L: f: (a:int(width=64), b:int(width=64))->NoneType delay(a + b mu) +# CHECK-L: f: (a:numpy.int64, b:numpy.int64)->NoneType delay(a + b mu) def f(a, b): with sequential: delay_mu(a) diff --git a/artiq/test/lit/monomorphism/integers.py b/artiq/test/lit/monomorphism/integers.py index bc66bcc5a..5c0e8be7f 100644 --- a/artiq/test/lit/monomorphism/integers.py +++ b/artiq/test/lit/monomorphism/integers.py @@ -2,10 +2,10 @@ # RUN: OutputCheck %s --file-to-check=%t x = 1 -# CHECK-L: x: int(width=32) +# CHECK-L: x: numpy.int32 y = int(1) -# CHECK-L: y: int(width=32) +# CHECK-L: y: numpy.int32 z = round(1.0) -# CHECK-L: z: int(width=32) +# CHECK-L: z: numpy.int32