Skip to content

Commit 36ee937

Browse files
authored
Merge pull request #18786 from rintaro/parse-istypecontext
[Parse] Don't use getAsNominalTypeOrNominalTypeExtensionContext in Parse
2 parents a779a16 + 682fc12 commit 36ee937

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4311,7 +4311,7 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer {
43114311
}
43124312

43134313
void getOverrideCompletions(SourceLoc Loc) {
4314-
if (!CurrDeclContext->getSelfNominalTypeDecl())
4314+
if (!CurrDeclContext->isTypeContext())
43154315
return;
43164316
if (isa<ProtocolDecl>(CurrDeclContext))
43174317
return;

lib/Parse/ParsePattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ ParserResult<Pattern> Parser::parsePattern() {
921921
}
922922

923923
case tok::code_complete:
924-
if (!CurDeclContext->getSelfNominalTypeDecl()) {
924+
if (!CurDeclContext->isTypeContext()) {
925925
// This cannot be an overridden property, so just eat the token. We cannot
926926
// code complete anything here -- we expect an identifier.
927927
consumeToken(tok::code_complete);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s
2+
3+
extension UnknownTy {
4+
var #^COMPLETE^#
5+
}

0 commit comments

Comments
 (0)