mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Rewrite witness method calls as ApplyExpr + DeclRefExpr
Special-casing these as MemberRefExprs created an asymmetry where unbound archetype instance methods (<T : P> T.f) could not be represented. Treating class and protocol methods uniformly also eliminates a handful of special cases around MemberRefExpr. SILGen's RValue and call emission peepholes now have to know about DeclRefExprs that point to protocol methods. Finally, generalize the diagnostic for partially applied mutating methods to any partially applied function with an inout parameter, since this is not supported. Fixes <rdar://problem/20564672>. Swift SVN r29298
This commit is contained in:
@@ -1010,14 +1010,7 @@ void ConstraintSystem::openGeneric(
|
||||
/// declared.
|
||||
static void addSelfConstraint(ConstraintSystem &cs, Type objectTy, Type selfTy,
|
||||
ConstraintLocatorBuilder locator){
|
||||
// When referencing a protocol member, we need the object type to be usable
|
||||
// as the Self type of the protocol, which covers anything that conforms to
|
||||
// the protocol as well as existentials that include that protocol.
|
||||
if (selfTy->is<ProtocolType>()) {
|
||||
cs.addConstraint(ConstraintKind::SelfObjectOfProtocol, objectTy, selfTy,
|
||||
cs.getConstraintLocator(locator));
|
||||
return;
|
||||
}
|
||||
assert(!selfTy->is<ProtocolType>());
|
||||
|
||||
// Otherwise, use a subtype constraint for classes to cope with inheritance.
|
||||
if (selfTy->getClassOrBoundGenericClass()) {
|
||||
|
||||
Reference in New Issue
Block a user