Skip to content

Commit e421b22

Browse files
author
whitequark
committedFeb 27, 2016
types.TypePrinter: don't waste screen space on empty attribute lists.
1 parent 63e0c7c commit e421b22

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎artiq/compiler/types.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -703,12 +703,14 @@ def name(self, typ, depth=0, max_depth=1):
703703
elif isinstance(typ, TInstance):
704704
if typ in self.recurse_guard or depth >= max_depth:
705705
return "<instance {}>".format(typ.name)
706-
else:
706+
elif len(typ.attributes) > 0:
707707
self.recurse_guard.add(typ)
708708
attrs = ",\n\t\t".join(["{}: {}".format(attr, self.name(typ.attributes[attr],
709709
depth + 1))
710710
for attr in typ.attributes])
711711
return "<instance {} {{\n\t\t{}\n\t}}>".format(typ.name, attrs)
712+
else:
713+
return "<instance {} {{}}>".format(typ.name)
712714
elif isinstance(typ, TMono):
713715
if typ.params == {}:
714716
return typ.name
@@ -745,12 +747,14 @@ def name(self, typ, depth=0, max_depth=1):
745747
elif isinstance(typ, (TConstructor, TExceptionConstructor)):
746748
if typ in self.recurse_guard or depth >= max_depth:
747749
return "<constructor {}>".format(typ.name)
748-
else:
750+
elif len(typ.attributes) > 0:
749751
self.recurse_guard.add(typ)
750752
attrs = ", ".join(["{}: {}".format(attr, self.name(typ.attributes[attr],
751753
depth + 1))
752754
for attr in typ.attributes])
753755
return "<constructor {} {{{}}}>".format(typ.name, attrs)
756+
else:
757+
return "<constructor {} {{}}>".format(typ.name)
754758
elif isinstance(typ, TBuiltin):
755759
return "<builtin {}>".format(typ.name)
756760
elif isinstance(typ, TValue):

0 commit comments

Comments
 (0)
Please sign in to comment.