Skip to content

Commit e35083d

Browse files
committed
[CodeCompletion] Avoid re-typechcking pre-checked expressions
in expression context analysis. They are simply not necessary. rdar://problem/60982638 (cherry picked from commit 3337d7b)
1 parent f378ad5 commit e35083d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/IDE/ExprContextAnalysis.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,16 @@ static void collectPossibleCalleesByQualifiedLookup(
379379
tyExpr->getTypeLoc().setType(nullptr);
380380
}
381381

382-
auto baseTyOpt = getTypeOfCompletionContextExpr(
383-
DC.getASTContext(), &DC, CompletionTypeCheckKind::Normal, baseExpr, ref);
384-
if (!baseTyOpt)
385-
return;
386-
387-
auto baseTy = (*baseTyOpt)->getWithoutSpecifierType();
382+
Type baseTy = baseExpr->getType();
383+
if (!baseTy || baseTy->is<ErrorType>()) {
384+
auto baseTyOpt = getTypeOfCompletionContextExpr(
385+
DC.getASTContext(), &DC, CompletionTypeCheckKind::Normal, baseExpr,
386+
ref);
387+
if (!baseTyOpt)
388+
return;
389+
baseTy = *baseTyOpt;
390+
}
391+
baseTy = baseTy->getWithoutSpecifierType();
388392
if (!baseTy->getMetatypeInstanceType()->mayHaveMembers())
389393
return;
390394

0 commit comments

Comments
 (0)