diff options
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5d49ad900..67d0dbdcc 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -3017,13 +3017,20 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { o << ')'; } void handleHeapType(HeapType type) { - bool hasSuper = false; - // TODO: Consider finality once we support that. - if (auto super = type.getSuperType()) { - hasSuper = true; + auto super = type.getSuperType(); + bool useSub = false; + // TODO: Once we parse MVP signature types as final, use the MVP shorthand + // for final types without supertypes. + if (super || type.isFinal()) { + useSub = true; o << "(sub "; - TypeNamePrinter(o, currModule).print(*super); - o << ' '; + if (type.isFinal()) { + o << "final "; + } + if (super) { + TypeNamePrinter(o, currModule).print(*super); + o << ' '; + } } if (type.isSignature()) { handleSignature(type); @@ -3034,7 +3041,7 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> { } else { o << type; } - if (hasSuper) { + if (useSub) { o << ')'; } } |