mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Implement missing case in existential erasure
Fixes https://github.com/apple/swift/issues/61934.
This commit is contained in:
@@ -2284,6 +2284,20 @@ static Type typeEraseExistentialSelfReferences(Type refTy, Type baseTy,
|
||||
}
|
||||
}
|
||||
|
||||
// Parameterized protocol types whose arguments involve this type
|
||||
// parameter are erased to the base type.
|
||||
if (auto parameterized = dyn_cast<ParameterizedProtocolType>(t)) {
|
||||
for (auto argType : parameterized->getArgs()) {
|
||||
auto erasedArgType =
|
||||
typeEraseExistentialSelfReferences(
|
||||
argType, baseTy, TypePosition::Covariant,
|
||||
existentialSig, containsFn, predicateFn, projectionFn,
|
||||
force, metatypeDepth);
|
||||
if (erasedArgType.getPointer() != argType.getPointer())
|
||||
return parameterized->getBaseType();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto lvalue = dyn_cast<LValueType>(t)) {
|
||||
auto objTy = lvalue->getObjectType();
|
||||
auto erasedTy =
|
||||
|
||||
Reference in New Issue
Block a user