2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-11 12:46:37 +08:00
artiq/lit-test/compiler/inferencer/unify.py

56 lines
970 B
Python
Raw Normal View History

# RUN: %python -m artiq.compiler.testbench.inferencer %s >%t
# RUN: OutputCheck %s --file-to-check=%t
a = 1
# CHECK-L: a:int(width='a)
b = a
# CHECK-L: b:int(width='a)
c = True
# CHECK-L: c:bool
d = False
# CHECK-L: d:bool
e = None
# CHECK-L: e:NoneType
f = 1.0
# CHECK-L: f:float
g = []
# CHECK-L: g:list(elt='b)
h = [1]
# CHECK-L: h:list(elt=int(width='c))
i = []
i[0] = 1
# CHECK-L: i:list(elt=int(width='d))
j = []
j += [1.0]
# CHECK-L: j:list(elt=float)
2015-06-11 08:22:20 +08:00
1 if c else 2
# CHECK-L: 1:int(width='f) if c:bool else 2:int(width='f):int(width='f)
2015-06-11 08:22:20 +08:00
True and False
# CHECK-L: True:bool and False:bool:bool
2015-06-11 09:20:33 +08:00
2015-06-12 13:59:41 +08:00
~1
2015-07-22 04:45:17 +08:00
# CHECK-L: ~1:int(width='g):int(width='g)
2015-06-12 13:59:41 +08:00
2015-07-22 04:45:17 +08:00
not True
# CHECK-L: not True:bool:bool
2015-06-15 13:40:37 +08:00
[x for x in [1]]
2015-07-22 04:45:17 +08:00
# CHECK-L: [x:int(width='h) for x:int(width='h) in [1:int(width='h)]:list(elt=int(width='h))]:list(elt=int(width='h))
lambda x, y=1: x
2015-07-22 04:45:17 +08:00
# CHECK-L: lambda x:'i, y:int(width='j)=1:int(width='j): x:'i:(x:'i, ?y:int(width='j))->'i
2015-07-21 19:27:48 +08:00
k = "x"
# CHECK-L: k:str