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:
Joe Groff
2019-07-11 15:12:43 -07:00
parent ba7393682d
commit a92fd9defb
2 changed files with 8 additions and 7 deletions

View File

@@ -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);