File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,9 @@ static MutableArrayRef<CodeCompletionResult *> copyCodeCompletionResults(
7171 };
7272 } else {
7373 shouldIncludeResult = [](const ContextFreeCodeCompletionResult *R) -> bool {
74- return true ;
74+ // PrecedenceGroups are only valid in 'onlyPrecedenceGroups'.
75+ return R->getAssociatedDeclKind () !=
76+ CodeCompletionDeclKind::PrecedenceGroup;
7577 };
7678 }
7779
Original file line number Diff line number Diff line change 1919// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGNMENT_1 | %FileCheck %s -check-prefix=ASSIGNMENT
2020// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGNMENT_2 | %FileCheck %s -check-prefix=ASSIGNMENT
2121
22+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_EXPR | %FileCheck %s -check-prefix=PRECEDENCE_GROUP_NEGATIVE
23+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GLOBAL_TYPE | %FileCheck %s -check-prefix=PRECEDENCE_GROUP_NEGATIVE
24+
2225infix operator +++ : #^PRECEDENCE_GROUP_1 ^#
2326
2427precedencegroup MyPrecedence1 {
@@ -82,6 +85,13 @@ precedencegroup MyPrecedence12 {
8285
8386infix operator --- : #^PRECEDENCE_GROUP_CURRFILE^#
8487
88+ func testExpr( ) {
89+ _ = #^GLOBAL_EXPR^#
90+ }
91+ func testType( ) {
92+ let _: #^GLOBAL_TYPE^#
93+ }
94+
8595// ATTRIBUTE_LIST: Begin completions, 4 items
8696// ATTRIBUTE_LIST: Keyword/None: associativity; name=associativity
8797// ATTRIBUTE_LIST: Keyword/None: higherThan; name=higherThan
@@ -117,3 +127,7 @@ infix operator ---: #^PRECEDENCE_GROUP_CURRFILE^#
117127// PRECEDENCE_GROUP_CURRFILE-DAG: Decl[PrecedenceGroup]/CurrModule: MyPrecedence{{[0-9]+}};
118128
119129// PRECEDENCE_GROUP_MULTIFILE: Decl[PrecedenceGroup]/CurrModule: PrecedenceGroupOtherFile; name=PrecedenceGroupOtherFile
130+
131+ // PRECEDENCE_GROUP_NEGATIVE: Begin completions
132+ // PRECEDENCE_GROUP_NEGATIVE-NOT: Decl[PrecedenceGroup]
133+ // PRECEDENCE_GROUP_NEGATIVE: End completions
You can’t perform that action at this time.
0 commit comments