Skip to content

[Parse] Don't use getAsNominalTypeOrNominalTypeExtensionContext in Parse #18786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4311,7 +4311,7 @@ class CompletionOverrideLookup : public swift::VisibleDeclConsumer {
}

void getOverrideCompletions(SourceLoc Loc) {
if (!CurrDeclContext->getSelfNominalTypeDecl())
if (!CurrDeclContext->isTypeContext())
return;
if (isa<ProtocolDecl>(CurrDeclContext))
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/Parse/ParsePattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ ParserResult<Pattern> Parser::parsePattern() {
}

case tok::code_complete:
if (!CurDeclContext->getSelfNominalTypeDecl()) {
if (!CurDeclContext->isTypeContext()) {
// This cannot be an overridden property, so just eat the token. We cannot
// code complete anything here -- we expect an identifier.
consumeToken(tok::code_complete);
Expand Down
5 changes: 5 additions & 0 deletions validation-test/IDE/crashers_2_fixed/sr8554.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s

extension UnknownTy {
var #^COMPLETE^#
}