Skip to content

Commit bfc98dc

Browse files
authored
Merge pull request #58481 from hborla/existential-type-metadata-fix
[IRGen] Restore the old code path for emitting existential type metadata for plain protocol and protocol composition types.
2 parents 4dd4b61 + bfa4c39 commit bfc98dc

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

lib/IRGen/MetadataRequest.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,16 @@ namespace {
18831883

18841884
MetadataResponse visitProtocolType(CanProtocolType type,
18851885
DynamicMetadataRequest request) {
1886-
llvm_unreachable("constraint type should be wrapped in existential type");
1886+
assert(false && "constraint type should be wrapped in existential type");
1887+
1888+
CanExistentialType existential(
1889+
ExistentialType::get(type)->castTo<ExistentialType>());
1890+
1891+
if (auto metatype = tryGetLocal(existential, request))
1892+
return metatype;
1893+
1894+
auto metadata = emitExistentialTypeMetadata(existential);
1895+
return setLocal(type, MetadataResponse::forComplete(metadata));
18871896
}
18881897

18891898
MetadataResponse
@@ -1892,7 +1901,16 @@ namespace {
18921901
if (type->isAny() || type->isAnyObject())
18931902
return emitSingletonExistentialTypeMetadata(type);
18941903

1895-
llvm_unreachable("constraint type should be wrapped in existential type");
1904+
assert(false && "constraint type should be wrapped in existential type");
1905+
1906+
CanExistentialType existential(
1907+
ExistentialType::get(type)->castTo<ExistentialType>());
1908+
1909+
if (auto metatype = tryGetLocal(existential, request))
1910+
return metatype;
1911+
1912+
auto metadata = emitExistentialTypeMetadata(existential);
1913+
return setLocal(type, MetadataResponse::forComplete(metadata));
18961914
}
18971915

18981916
MetadataResponse

0 commit comments

Comments
 (0)