Allow protocol methods that return Self? to be

called on existentials.

Swift SVN r15774
This commit is contained in:
John McCall
2014-04-02 04:01:18 +00:00
parent 25464e9202
commit cc0dcfed2e
2 changed files with 30 additions and 4 deletions

View File

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