Skip to content

Commit f76f1a7

Browse files
committed
Add a Hack
Reconstitute the ExistentialType wrapper around a (parameterized) protocol type. The AST needs to be remodeled here before we can remove this.
1 parent d710b52 commit f76f1a7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/IRGen/MetadataRequest.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,16 @@ usesExtendedExistentialMetadata(CanExistentialMetatypeType type) {
280280

281281
// The only existential types that don't currently use ExistentialType
282282
// are Any and AnyObject, which don't use extended metadata.
283-
if (usesExtendedExistentialMetadata(cur))
283+
if (usesExtendedExistentialMetadata(cur)) {
284+
// HACK: The AST for an existential metatype of a (parameterized) protocol
285+
// still directly wraps the existential type as its instance, which means
286+
// we need to reconstitute the enclosing ExistentialType.
287+
assert(cur->isExistentialType());
288+
if (!cur->is<ExistentialType>()) {
289+
cur = ExistentialType::get(cur)->getCanonicalType();
290+
}
284291
return std::make_pair(cast<ExistentialType>(cur), depth);
292+
}
285293
return None;
286294
}
287295

0 commit comments

Comments
 (0)