Skip to content

[4.0] [Parse] Don't tell CodeCompletion nonsense about protocol/AT where clauses #9710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5357,8 +5357,6 @@ parseDeclProtocol(ParseDeclOptions Flags, DeclAttributes &Attributes) {
Status |= parseInheritance(InheritedProtocols, &classRequirementLoc);
}

// Parse a 'where' clause if present. These are not supported, but we will
// get better QoI this way.
TrailingWhereClause *TrailingWhere = nullptr;
// Parse a 'where' clause if present.
if (Tok.is(tok::kw_where)) {
Expand Down
7 changes: 1 addition & 6 deletions lib/Parse/ParseGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,7 @@ ParserStatus Parser::parseProtocolOrAssociatedTypeWhereClause(
trailingWhere =
TrailingWhereClause::create(Context, whereLoc, requirements);
} else if (whereStatus.hasCodeCompletion()) {
// FIXME: this is completely (hah) cargo culted.
if (CodeCompletion && firstTypeInComplete) {
CodeCompletion->completeGenericParams(nullptr);
} else {
return makeParserCodeCompletionStatus();
}
return whereStatus;
}

return ParserStatus();
Expand Down
6 changes: 6 additions & 0 deletions test/IDE/complete_crashes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,9 @@ struct S_RDAR_28991372 {

S_RDAR_28991372(x: #^RDAR_28991372^#, y: <#T##Int#>)
// RDAR_28991372: Begin completions

// rdar://problem/31981486
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=RDAR_31981486 | %FileCheck %s -check-prefix=RDAR_31981486

protocol P where #^RDAR_31981486^#
// RDAR_31981486: Begin completions

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s
// REQUIRES: asserts

protocol a where #^A^#