File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2196,11 +2196,15 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
2196
2196
// #keyPath is only available when the Objective-C runtime is.
2197
2197
if (!Ctx.LangOpts .EnableObjCInterop ) return ;
2198
2198
2199
+ // After #, this is a very likely result. When just in a String context,
2200
+ // it's not.
2201
+ auto semanticContext = needPound ? SemanticContextKind::None
2202
+ : SemanticContextKind::ExpressionSpecific;
2203
+
2199
2204
CodeCompletionResultBuilder Builder (
2200
2205
Sink,
2201
2206
CodeCompletionResult::ResultKind::Keyword,
2202
- SemanticContextKind::ExpressionSpecific,
2203
- ExpectedTypes);
2207
+ semanticContext, ExpectedTypes);
2204
2208
if (needPound)
2205
2209
Builder.addTextChunk (" #keyPath" );
2206
2210
else
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ func completeInKeyPath2() {
36
36
37
37
// CHECK-AFTER_POUND: Keyword/ExprSpecific: keyPath({#@objc property sequence#}); name=keyPath(@objc property sequence)
38
38
39
- // CHECK-KEYPATH_ARG: Keyword/ExprSpecific: #keyPath({#@objc property sequence#}); name=#keyPath(@objc property sequence)
39
+ // CHECK-KEYPATH_ARG: Keyword/None: #keyPath({#@objc property sequence#}); name=#keyPath(@objc property sequence)
40
40
41
41
// CHECK-IN_KEYPATH: Decl[InstanceVar]/CurrNominal: prop1[#String#]; name=prop1
42
42
// CHECK-IN_KEYPATH: Decl[InstanceVar]/CurrNominal: prop2[#ObjCClass?#]; name=prop2
You can’t perform that action at this time.
0 commit comments