forked from M-Labs/artiq
1
0
Fork 0

Fix tests.

This commit is contained in:
whitequark 2015-08-28 00:51:31 -05:00
parent 7c1abb25ec
commit 13e612c11b
5 changed files with 15 additions and 15 deletions

View File

@ -521,10 +521,10 @@ class TypePrinter(object):
self.map[typ] = "'%s" % next(self.gen) self.map[typ] = "'%s" % next(self.gen)
return self.map[typ] return self.map[typ]
elif isinstance(typ, TInstance): elif isinstance(typ, TInstance):
if typ.name in self.recurse_guard: if typ in self.recurse_guard:
return "<instance {}>".format(typ.name) return "<instance {}>".format(typ.name)
else: else:
self.recurse_guard.add(typ.name) self.recurse_guard.add(typ)
attrs = ", ".join(["{}: {}".format(attr, self.name(typ.attributes[attr])) attrs = ", ".join(["{}: {}".format(attr, self.name(typ.attributes[attr]))
for attr in typ.attributes]) for attr in typ.attributes])
return "<instance {} {{{}}}>".format(typ.name, attrs) return "<instance {} {{{}}}>".format(typ.name, attrs)
@ -554,10 +554,10 @@ class TypePrinter(object):
elif isinstance(typ, TBuiltinFunction): elif isinstance(typ, TBuiltinFunction):
return "<function {}>".format(typ.name) return "<function {}>".format(typ.name)
elif isinstance(typ, (TConstructor, TExceptionConstructor)): elif isinstance(typ, (TConstructor, TExceptionConstructor)):
if typ.name in self.recurse_guard: if typ in self.recurse_guard:
return "<constructor {}>".format(typ.name) return "<constructor {}>".format(typ.name)
else: else:
self.recurse_guard.add(typ.name) self.recurse_guard.add(typ)
attrs = ", ".join(["{}: {}".format(attr, self.name(typ.attributes[attr])) attrs = ", ".join(["{}: {}".format(attr, self.name(typ.attributes[attr]))
for attr in typ.attributes]) for attr in typ.attributes])
return "<constructor {} {{{}}}>".format(typ.name, attrs) return "<constructor {} {{{}}}>".format(typ.name, attrs)

View File

@ -4,22 +4,22 @@
# CHECK-L: bool:<constructor bool {}>():bool # CHECK-L: bool:<constructor bool {}>():bool
bool() bool()
# CHECK-L: bool:<constructor bool {}>([]:list(elt='a)):bool # CHECK-L: bool:<constructor bool>([]:list(elt='a)):bool
bool([]) bool([])
# CHECK-L: int:<constructor int {}>():int(width='b) # CHECK-L: int:<constructor int {}>():int(width='b)
int() int()
# CHECK-L: int:<constructor int {}>(1.0:float):int(width='c) # CHECK-L: int:<constructor int>(1.0:float):int(width='c)
int(1.0) int(1.0)
# CHECK-L: int:<constructor int {}>(1.0:float, width=64:int(width='d)):int(width=64) # CHECK-L: int:<constructor int>(1.0:float, width=64:int(width='d)):int(width=64)
int(1.0, width=64) int(1.0, width=64)
# CHECK-L: float:<constructor float {}>():float # CHECK-L: float:<constructor float {}>():float
float() float()
# CHECK-L: float:<constructor float {}>(1:int(width='e)):float # CHECK-L: float:<constructor float>(1:int(width='e)):float
float(1) float(1)
# CHECK-L: list:<constructor list {}>():list(elt='f) # CHECK-L: list:<constructor list {}>():list(elt='f)

View File

@ -8,12 +8,12 @@ class c:
def m(self): def m(self):
pass pass
# CHECK-L: c:<constructor c {a: int(width='a), f: ()->NoneType, m: (self:c)->NoneType}> # CHECK-L: c:<constructor c {a: int(width='a), f: ()->NoneType, m: (self:<instance c>)->NoneType}>
c c
# CHECK-L: .a:int(width='a) # CHECK-L: .a:int(width='a)
c.a c.a
# CHECK-L: .f:()->NoneType # CHECK-L: .f:()->NoneType
c.f c.f
# CHECK-L: .m:method(fn=(self:c)->NoneType, self=c) # CHECK-L: .m:method(fn=(self:<instance c>)->NoneType, self=<instance c>)
c().m() c().m()

View File

@ -12,5 +12,5 @@ class c:
c().f() c().f()
c.g(1) c.g(1)
# CHECK-L: ${LINE:+1}: error: cannot unify c with int(width='a) while inferring the type for self argument # CHECK-L: ${LINE:+1}: error: cannot unify <instance c> with int(width='a) while inferring the type for self argument
c().g() c().g()

View File

@ -61,13 +61,13 @@ IndexError()
# CHECK-L: IndexError:<constructor IndexError {}>():IndexError # CHECK-L: IndexError:<constructor IndexError {}>():IndexError
IndexError("x") IndexError("x")
# CHECK-L: IndexError:<constructor IndexError {}>("x":str):IndexError # CHECK-L: IndexError:<constructor IndexError>("x":str):IndexError
IndexError("x", 1) IndexError("x", 1)
# CHECK-L: IndexError:<constructor IndexError {}>("x":str, 1:int(width=64)):IndexError # CHECK-L: IndexError:<constructor IndexError>("x":str, 1:int(width=64)):IndexError
IndexError("x", 1, 1) IndexError("x", 1, 1)
# CHECK-L: IndexError:<constructor IndexError {}>("x":str, 1:int(width=64), 1:int(width=64)):IndexError # CHECK-L: IndexError:<constructor IndexError>("x":str, 1:int(width=64), 1:int(width=64)):IndexError
IndexError("x", 1, 1, 1) IndexError("x", 1, 1, 1)
# CHECK-L: IndexError:<constructor IndexError {}>("x":str, 1:int(width=64), 1:int(width=64), 1:int(width=64)):IndexError # CHECK-L: IndexError:<constructor IndexError>("x":str, 1:int(width=64), 1:int(width=64), 1:int(width=64)):IndexError