Skip to content

Commit 5e90741

Browse files
committed
[Parse] Don't tell CodeCompletion nonsense about protocol/AT where clauses.
This doesn't give particularly useful information yet (i.e. Self isn't listed, see rdar://problem/31981641 ), but it does stop the completion code from just directly crashing. Fixes rdar://problem/31981486.
1 parent ef95a33 commit 5e90741

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

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)