Skip to content

Commit 77cb4b6

Browse files
authored
Merge pull request #38559 from ahoppen/pr/dont-add-members-twice
[CodeCompletion] Fix issue causing the completion status to not be set correctly for pattern completion
2 parents 4434ee9 + fec7f6c commit 77cb4b6

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

lib/Parse/ParsePattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ ParserResult<Pattern> Parser::parsePattern() {
11381138
// code complete anything here -- we expect an identifier.
11391139
consumeToken(tok::code_complete);
11401140
}
1141-
return nullptr;
1141+
return makeParserCodeCompletionStatus();
11421142

11431143
case tok::kw_var:
11441144
case tok::kw_let: {

test/IDE/complete_override.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,3 +757,13 @@ class SynthesizedConformance5: SynthesizedConformance2 {
757757
// OVERRIDE_SYNTHESIZED_5-DAG: Decl[Constructor]/Super: required init(from decoder: Decoder) throws {|};
758758
// FIXME: 'required init(from decoder: Decoder)' is suggested twice
759759
}
760+
761+
protocol ProtocolSr14687 {
762+
var value: Int { get }
763+
}
764+
struct StructSr14687: ProtocolSr14687 {
765+
let foo = val, #^MULTI_VAR_DECL_OVERRIDE^#
766+
// MULTI_VAR_DECL_OVERRIDE: Begin completions, 1 items
767+
// MULTI_VAR_DECL_OVERRIDE-DAG: Decl[InstanceVar]/Super: value: Int;
768+
// MULTI_VAR_DECL_OVERRIDE: End completions
769+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE
2+
3+
class Foo {
4+
let searchSubject = Bar<String, #^COMPLETE^#
5+
}

0 commit comments

Comments
 (0)