From e421b229538d6b7ba5ed01dadf83fcd254771e35 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 27 Feb 2016 13:29:47 +0000 Subject: [PATCH] types.TypePrinter: don't waste screen space on empty attribute lists. --- artiq/compiler/types.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/types.py b/artiq/compiler/types.py index fdb225d9c..0f0819b2a 100644 --- a/artiq/compiler/types.py +++ b/artiq/compiler/types.py @@ -703,12 +703,14 @@ class TypePrinter(object): elif isinstance(typ, TInstance): if typ in self.recurse_guard or depth >= max_depth: return "".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 "".format(typ.name, attrs) + else: + return "".format(typ.name) elif isinstance(typ, TMono): if typ.params == {}: return typ.name @@ -745,12 +747,14 @@ class TypePrinter(object): elif isinstance(typ, (TConstructor, TExceptionConstructor)): if typ in self.recurse_guard or depth >= max_depth: return "".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 "".format(typ.name, attrs) + else: + return "".format(typ.name) elif isinstance(typ, TBuiltin): return "".format(typ.name) elif isinstance(typ, TValue):