[CodeCompletion] Don't mark #keyPath as "expression specific" without #

We suggest #keyPath in every String context, so having it be
expression-specific is artificially increasing its priority.

rdar://problem/26544672
This commit is contained in:
Ben Langmuir
2016-05-31 11:42:01 -07:00
parent f8b1f81182
commit 56158fca08
2 changed files with 7 additions and 3 deletions

View File

@@ -2196,11 +2196,15 @@ public:
// #keyPath is only available when the Objective-C runtime is.
if (!Ctx.LangOpts.EnableObjCInterop) return;
// After #, this is a very likely result. When just in a String context,
// it's not.
auto semanticContext = needPound ? SemanticContextKind::None
: SemanticContextKind::ExpressionSpecific;
CodeCompletionResultBuilder Builder(
Sink,
CodeCompletionResult::ResultKind::Keyword,
SemanticContextKind::ExpressionSpecific,
ExpectedTypes);
semanticContext, ExpectedTypes);
if (needPound)
Builder.addTextChunk("#keyPath");
else

View File

@@ -36,7 +36,7 @@ func completeInKeyPath2() {
// CHECK-AFTER_POUND: Keyword/ExprSpecific: keyPath({#@objc property sequence#}); name=keyPath(@objc property sequence)
// CHECK-KEYPATH_ARG: Keyword/ExprSpecific: #keyPath({#@objc property sequence#}); name=#keyPath(@objc property sequence)
// CHECK-KEYPATH_ARG: Keyword/None: #keyPath({#@objc property sequence#}); name=#keyPath(@objc property sequence)
// CHECK-IN_KEYPATH: Decl[InstanceVar]/CurrNominal: prop1[#String#]; name=prop1
// CHECK-IN_KEYPATH: Decl[InstanceVar]/CurrNominal: prop2[#ObjCClass?#]; name=prop2