Skip to content

Commit 8c8f35e

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 aadb959 commit 8c8f35e

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
@@ -385,12 +385,7 @@ ParserStatus Parser::parseProtocolOrAssociatedTypeWhereClause(
385385
trailingWhere =
386386
TrailingWhereClause::create(Context, whereLoc, requirements);
387387
} else if (whereStatus.hasCodeCompletion()) {
388-
// FIXME: this is completely (hah) cargo culted.
389-
if (CodeCompletion && firstTypeInComplete) {
390-
CodeCompletion->completeGenericParams(nullptr);
391-
} else {
392-
return makeParserCodeCompletionStatus();
393-
}
388+
return whereStatus;
394389
}
395390

396391
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)