Skip to content

Commit aa4179e

Browse files
committed
IRGen: Workaround for inadvertent mangling of opened archetypes in keypath descriptors
Fixes rdar://problem/101825468.
1 parent beac603 commit aa4179e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/IRGen/GenKeyPath.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,15 @@ emitKeyPathComponent(IRGenModule &IGM,
887887
componentCanSig, [&](GenericRequirement reqt) {
888888
auto substType =
889889
reqt.TypeParameter.subst(subs)->getCanonicalType();
890+
891+
// FIXME: This seems wrong. We used to just mangle opened archetypes as
892+
// their interface type. Let's make that explicit now.
893+
substType = substType.transformRec([](Type t) -> Optional<Type> {
894+
if (auto *openedExistential = t->getAs<OpenedArchetypeType>())
895+
return openedExistential->getInterfaceType();
896+
return None;
897+
})->getCanonicalType();
898+
890899
if (!reqt.Protocol) {
891900
// Type requirement.
892901
externalSubArgs.push_back(emitMetadataTypeRefForKeyPath(

0 commit comments

Comments
 (0)