Skip to content

Commit a4e3274

Browse files
authored
Merge pull request #9710 from huonw/where-completion-crash
[4.0] [Parse] Don't tell CodeCompletion nonsense about protocol/AT where clauses
2 parents c18a492 + 5e90741 commit a4e3274

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5357,8 +5357,6 @@ parseDeclProtocol(ParseDeclOptions Flags, DeclAttributes &Attributes) {
53575357
Status |= parseInheritance(InheritedProtocols, &classRequirementLoc);
53585358
}
53595359

5360-
// Parse a 'where' clause if present. These are not supported, but we will
5361-
// get better QoI this way.
53625360
TrailingWhereClause *TrailingWhere = nullptr;
53635361
// Parse a 'where' clause if present.
53645362
if (Tok.is(tok::kw_where)) {

lib/Parse/ParseGeneric.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,7 @@ ParserStatus Parser::parseProtocolOrAssociatedTypeWhereClause(
390390
trailingWhere =
391391
TrailingWhereClause::create(Context, whereLoc, requirements);
392392
} else if (whereStatus.hasCodeCompletion()) {
393-
// FIXME: this is completely (hah) cargo culted.
394-
if (CodeCompletion && firstTypeInComplete) {
395-
CodeCompletion->completeGenericParams(nullptr);
396-
} else {
397-
return makeParserCodeCompletionStatus();
398-
}
393+
return whereStatus;
399394
}
400395

401396
return ParserStatus();

test/IDE/complete_crashes.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,9 @@ struct S_RDAR_28991372 {
196196

197197
S_RDAR_28991372(x: #^RDAR_28991372^#, y: <#T##Int#>)
198198
// RDAR_28991372: Begin completions
199+
200+
// rdar://problem/31981486
201+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_31981486 | %FileCheck %s -check-prefix=RDAR_31981486
202+
203+
protocol P where #^RDAR_31981486^#
204+
// RDAR_31981486: Begin completions

validation-test/IDE/crashers_2/0012-protocol-where-clause.swift

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
2+
// REQUIRES: asserts
3+
4+
protocol a where #^A^#

0 commit comments

Comments
 (0)