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(
71
71
};
72
72
} else {
73
73
shouldIncludeResult = [](const ContextFreeCodeCompletionResult *R) -> bool {
74
- return true ;
74
+ // PrecedenceGroups are only valid in 'onlyPrecedenceGroups'.
75
+ return R->getAssociatedDeclKind () !=
76
+ CodeCompletionDeclKind::PrecedenceGroup;
75
77
};
76
78
}
77
79
Original file line number Diff line number Diff line change 19
19
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGNMENT_1 | %FileCheck %s -check-prefix=ASSIGNMENT
20
20
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ASSIGNMENT_2 | %FileCheck %s -check-prefix=ASSIGNMENT
21
21
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
+
22
25
infix operator +++ : #^PRECEDENCE_GROUP_1 ^#
23
26
24
27
precedencegroup MyPrecedence1 {
@@ -82,6 +85,13 @@ precedencegroup MyPrecedence12 {
82
85
83
86
infix operator --- : #^PRECEDENCE_GROUP_CURRFILE^#
84
87
88
+ func testExpr( ) {
89
+ _ = #^GLOBAL_EXPR^#
90
+ }
91
+ func testType( ) {
92
+ let _: #^GLOBAL_TYPE^#
93
+ }
94
+
85
95
// ATTRIBUTE_LIST: Begin completions, 4 items
86
96
// ATTRIBUTE_LIST: Keyword/None: associativity; name=associativity
87
97
// ATTRIBUTE_LIST: Keyword/None: higherThan; name=higherThan
@@ -117,3 +127,7 @@ infix operator ---: #^PRECEDENCE_GROUP_CURRFILE^#
117
127
// PRECEDENCE_GROUP_CURRFILE-DAG: Decl[PrecedenceGroup]/CurrModule: MyPrecedence{{[0-9]+}};
118
128
119
129
// 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