diff options
Diffstat (limited to 'src/passes/Print.cpp')
-rw-r--r-- | src/passes/Print.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5a5d01299..5c8463f78 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2219,7 +2219,15 @@ struct PrintExpressionContents printMedium(o, "br_on_cast "); curr->name.print(o); o << ' '; - printType(curr->ref->type); + if (curr->ref->type == Type::unreachable) { + // Need to print some reference type in the correct hierarchy rather + // than unreachable, and the bottom type is valid in the most + // contexts. + printType( + Type(curr->castType.getHeapType().getBottom(), NonNullable)); + } else { + printType(curr->ref->type); + } o << ' '; printType(curr->castType); return; @@ -2227,7 +2235,12 @@ struct PrintExpressionContents printMedium(o, "br_on_cast_fail "); curr->name.print(o); o << ' '; - printType(curr->ref->type); + if (curr->ref->type == Type::unreachable) { + printType( + Type(curr->castType.getHeapType().getBottom(), NonNullable)); + } else { + printType(curr->ref->type); + } o << ' '; printType(curr->castType); return; |