mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Be lenient in callee analysis
Accept `getInterfaceType->hasError()` declarations. Even if the part of
the declaration has error, we still have chance to get context info from
the other part of it. For instance:
func foo(x: Int, y: INt) { }
foo(x: #^COMPLETE^#
We should resolve 'Int' as the context type even if parameter `y` is an
error type.
This commit is contained in:
@@ -4993,12 +4993,13 @@ void collectPossibleCalleesByQualifiedLookup(
|
||||
Type declaredMemberType = VD->getInterfaceType();
|
||||
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(VD))
|
||||
if (AFD->getDeclContext()->isTypeContext())
|
||||
declaredMemberType = AFD->getMethodInterfaceType();
|
||||
declaredMemberType =
|
||||
declaredMemberType->castTo<AnyFunctionType>()->getResult();
|
||||
|
||||
auto fnType =
|
||||
baseTy->getTypeOfMember(DC.getParentModule(), VD, declaredMemberType);
|
||||
|
||||
if (!fnType || fnType->hasError())
|
||||
if (!fnType)
|
||||
continue;
|
||||
if (auto *AFT = fnType->getAs<AnyFunctionType>()) {
|
||||
candidates.emplace_back(AFT, VD);
|
||||
|
||||
Reference in New Issue
Block a user