mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Don't allow overloading by opaque types with different constraints.
The mangling unfortunately doesn't take the constraints into account, leading to SR-10725 | rdar://problem/50987172. Changing the mangling at this point is hazardous, so it's probably best to disallow this for now.
This commit is contained in:
@@ -2369,7 +2369,7 @@ static Type mapSignatureFunctionType(ASTContext &ctx, Type type,
|
||||
// Functions and subscripts cannot overload differing only in opaque return
|
||||
// types. Replace the opaque type with `Any`.
|
||||
if (auto opaque = type->getAs<OpaqueTypeArchetypeType>()) {
|
||||
type = opaque->getExistentialType();
|
||||
type = ProtocolCompositionType::get(ctx, {}, /*hasAnyObject*/ false);
|
||||
}
|
||||
|
||||
return mapSignatureParamType(ctx, type);
|
||||
|
||||
Reference in New Issue
Block a user