Skip to content

Commit 32dc261

Browse files
committed
[CodeCompletion] Don't crash in CompletionLookup if function type has no extInfo
1 parent 071090f commit 32dc261

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/IDE/CompletionLookup.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -977,13 +977,14 @@ void CompletionLookup::addEffectsSpecifiers(
977977
assert(AFT != nullptr);
978978

979979
// 'async'.
980-
if (forceAsync || (AFD && AFD->hasAsync()) || AFT->isAsync())
980+
if (forceAsync || (AFD && AFD->hasAsync()) ||
981+
(AFT->hasExtInfo() && AFT->isAsync()))
981982
Builder.addAnnotatedAsync();
982983

983984
// 'throws' or 'rethrows'.
984985
if (AFD && AFD->getAttrs().hasAttribute<RethrowsAttr>())
985986
Builder.addAnnotatedRethrows();
986-
else if (AFT->isThrowing())
987+
else if (AFT->hasExtInfo() && AFT->isThrowing())
987988
Builder.addAnnotatedThrows();
988989
}
989990

@@ -1146,7 +1147,8 @@ void CompletionLookup::addFunctionCallPattern(
11461147
else
11471148
addTypeAnnotation(Builder, AFT->getResult(), genericSig);
11481149

1149-
if (!isForCaching() && AFT->isAsync() && !CanCurrDeclContextHandleAsync) {
1150+
if (!isForCaching() && AFT->hasExtInfo() && AFT->isAsync() &&
1151+
!CanCurrDeclContextHandleAsync) {
11501152
Builder.setContextualNotRecommended(
11511153
ContextualNotRecommendedReason::InvalidAsyncContext);
11521154
}

0 commit comments

Comments
 (0)