[code-completion] Handle func-reference syntax for optional expected type

The underlying type-check was correct, but I forgot to consider it in
the outer code, and embarassingly never tested this case.

rdar://problem/28435922
This commit is contained in:
Ben Langmuir
2016-10-28 13:37:35 -07:00
parent 7a3a1e3697
commit 32f131e9ab
2 changed files with 18 additions and 1 deletions

View File

@@ -1652,7 +1652,9 @@ private:
return true;
bool isImplicitlyCurriedIM = isImplicitlyCurriedInstanceMethod(D);
for (auto expectedType : ExpectedTypes) {
if (expectedType && expectedType->is<AnyFunctionType>() &&
if (expectedType &&
expectedType->lookThroughAllAnyOptionalTypes()
->is<AnyFunctionType>() &&
calculateTypeRelationForDecl(D, expectedType, isImplicitlyCurriedIM,
/*UseFuncResult=*/false) >=
CodeCompletionResult::ExpectedTypeRelation::Convertible) {