mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow protocol methods that return Self? to be
called on existentials. Swift SVN r15774
This commit is contained in:
@@ -1312,6 +1312,10 @@ static bool isUnavailableInExistential(TypeChecker &tc, ValueDecl *decl) {
|
||||
|
||||
type = fnType->getResult();
|
||||
}
|
||||
|
||||
// Look through one level of optional on the result type.
|
||||
if (auto valueType = type->getAnyOptionalObjectType())
|
||||
type = valueType;
|
||||
|
||||
if (isProtocolSelf(type) || type->is<DynamicSelfType>())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user