Merge remote-tracking branch 'm-labs/master' into spimaster

* m-labs/master:
  Fix tests.
  types.TypePrinter: don't waste screen space on empty attribute lists.
  Revert wrong parts of 6bd16e44.
  examples/notebook: cleanup, and fix spelling
  test/LoopbackCount: request correct devices
This commit is contained in:
Robert Jördens 2016-02-29 00:49:13 +01:00
commit a4504905bd
4 changed files with 82 additions and 46 deletions

View File

@ -703,12 +703,15 @@ class TypePrinter(object):
elif isinstance(typ, TInstance):
if typ in self.recurse_guard or depth >= max_depth:
return "<instance {}>".format(typ.name)
else:
elif len(typ.attributes) > 0:
self.recurse_guard.add(typ)
attrs = ",\n\t\t".join(["{}: {}".format(attr, self.name(typ.attributes[attr],
depth + 1))
for attr in typ.attributes])
return "<instance {} {{\n\t\t{}\n\t}}>".format(typ.name, attrs)
else:
self.recurse_guard.add(typ)
return "<instance {} {{}}>".format(typ.name)
elif isinstance(typ, TMono):
if typ.params == {}:
return typ.name
@ -745,12 +748,15 @@ class TypePrinter(object):
elif isinstance(typ, (TConstructor, TExceptionConstructor)):
if typ in self.recurse_guard or depth >= max_depth:
return "<constructor {}>".format(typ.name)
else:
elif len(typ.attributes) > 0:
self.recurse_guard.add(typ)
attrs = ", ".join(["{}: {}".format(attr, self.name(typ.attributes[attr],
depth + 1))
for attr in typ.attributes])
return "<constructor {} {{{}}}>".format(typ.name, attrs)
else:
self.recurse_guard.add(typ)
return "<constructor {} {{}}>".format(typ.name)
elif isinstance(typ, TBuiltin):
return "<builtin {}>".format(typ.name)
elif isinstance(typ, TValue):

View File

@ -104,7 +104,8 @@ class Watchdog(EnvExperiment):
class LoopbackCount(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("ttl_inout")
self.setattr_device("loop_in")
self.setattr_device("loop_out")
self.setattr_argument("npulses")
def set_count(self, count):

View File

@ -11,7 +11,7 @@ class contextmgr:
def foo():
contextmgr.__enter__(1)
# CHECK-L: ${LINE:+3}: error: cannot unify <instance contextmgr> with int(width='a) while inferring the type for self argument
# CHECK-L: ${LINE:+2}: note: expression of type <instance contextmgr>
# CHECK-L: ${LINE:+2}: note: expression of type <instance contextmgr {}>
# CHECK-L: ${LINE:+1}: note: reference to an instance with a method '__enter__(self:int(width='a))->NoneType delay('b)'
with contextmgr():
pass

File diff suppressed because one or more lines are too long