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

We weren’t setting the code completion token status correctly when parsing patterns with code completion tokens.

Because of this, in the added test case, the `searchSubject` gets added as a member of `Foo` twice - once in the first pass and once in the second pass, causing an assertion failure.

Fixes rdar://80575116 [SR-14687]
This commit is contained in:
Alex Hoppen
2021-07-22 16:51:20 +02:00
parent 41a1761bde
commit fec7f6c3c0
3 changed files with 16 additions and 1 deletions

View File

@@ -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: {