Skip to content

Commit ce2dfeb

Browse files
committed
Failing Casts Should Not Crash
Return a NULL demangle tree instead of crashing. When an unconditional runtime cast fails, it's going to crash anyways, but this way it prints a better description (though not great) than the unreachable's message here.
1 parent 9a7f821 commit ce2dfeb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/runtime/Demangle.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,11 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type,
444444
return proto_list;
445445
}
446446
case MetadataKind::ExtendedExistential: {
447-
swift_unreachable("Extended existentials not supported");
447+
// FIXME: Implement this by demangling the extended existential and
448+
// substituting the generalization arguments into the demangle tree.
449+
// For now, unconditional casts will report '<<< invalid type >>>' when
450+
// they fail.
451+
return nullptr;
448452
}
449453
case MetadataKind::ExistentialMetatype: {
450454
auto metatype = static_cast<const ExistentialMetatypeMetadata *>(type);

0 commit comments

Comments
 (0)