Skip to content

[CodeCompletion] Fix issue causing the completion status to not be set correctly for pattern completion #38559

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
Jul 28, 2021
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/Parse/ParsePattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ ParserResult<Pattern> Parser::parsePattern() {
// code complete anything here -- we expect an identifier.
consumeToken(tok::code_complete);
}
return nullptr;
return makeParserCodeCompletionStatus();

case tok::kw_var:
case tok::kw_let: {
Expand Down
10 changes: 10 additions & 0 deletions test/IDE/complete_override.swift
Original file line number Diff line number Diff line change
Expand Up @@ -757,3 +757,13 @@ class SynthesizedConformance5: SynthesizedConformance2 {
// OVERRIDE_SYNTHESIZED_5-DAG: Decl[Constructor]/Super: required init(from decoder: Decoder) throws {|};
// FIXME: 'required init(from decoder: Decoder)' is suggested twice
}

protocol ProtocolSr14687 {
var value: Int { get }
}
struct StructSr14687: ProtocolSr14687 {
let foo = val, #^MULTI_VAR_DECL_OVERRIDE^#
// MULTI_VAR_DECL_OVERRIDE: Begin completions, 1 items
// MULTI_VAR_DECL_OVERRIDE-DAG: Decl[InstanceVar]/Super: value: Int;
// MULTI_VAR_DECL_OVERRIDE: End completions
}
5 changes: 5 additions & 0 deletions validation-test/IDE/crashers_2_fixed/sr14687.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE

class Foo {
let searchSubject = Bar<String, #^COMPLETE^#
}