Skip to content

[CodeCompletion] Prioritize type matching overload for unresovled member #31307

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 1 commit into from
Apr 27, 2020
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
40 changes: 33 additions & 7 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,10 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
expectedTypeContext.possibleTypes.push_back(T);
}

void setIdealExpectedType(Type Ty) {
expectedTypeContext.idealType = Ty;
}

CodeCompletionContext::TypeContextKind typeContextKind() const {
if (expectedTypeContext.empty()) {
return CodeCompletionContext::TypeContextKind::None;
Expand Down Expand Up @@ -2011,12 +2015,6 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
if (ForcedSemanticContext)
return *ForcedSemanticContext;

if (IsUnresolvedMember) {
if (isa<EnumElementDecl>(D)) {
return SemanticContextKind::ExpressionSpecific;
}
}

switch (Reason) {
case DeclVisibilityKind::LocalVariable:
case DeclVisibilityKind::FunctionParameter:
Expand Down Expand Up @@ -2080,6 +2078,23 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
llvm_unreachable("unhandled kind");
}

bool isUnresolvedMemberIdealType(Type Ty) {
assert(Ty);
if (!IsUnresolvedMember)
return false;
Type idealTy = expectedTypeContext.idealType;
if (!idealTy)
return false;
/// Consider optional object type is the ideal.
/// For exmaple:
/// enum MyEnum { case foo, bar }
/// func foo(_: MyEnum?)
/// fooo(.<HERE>)
/// Prefer '.foo' and '.bar' over '.some' and '.none'.
idealTy = idealTy->lookThroughAllOptionalTypes();
return idealTy->isEqual(Ty);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isEqual instead of isConvertible?

Copy link
Member Author

@rintaro rintaro Apr 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning convertible types by static member is pretty uncommon, I guess.

class Derived: Base { ... }
extension Base {
  static func createSub() -> Derived { ... }
}

I just didn't want to check them all by relatively heavy isConvertible() just for prioritization. But if you think it's worth it, I'm happy to do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, just making sure I understand.

}

void addValueBaseName(CodeCompletionResultBuilder &Builder,
DeclBaseName Name) {
auto NameStr = Name.userFacingName();
Expand Down Expand Up @@ -2406,6 +2421,9 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
DynamicOrOptional);
else
addTypeAnnotation(Builder, VarType);

if (isUnresolvedMemberIdealType(VarType))
Builder.setSemanticContext(SemanticContextKind::ExpressionSpecific);
}

static bool hasInterestingDefaultValues(const AbstractFunctionDecl *func) {
Expand Down Expand Up @@ -2862,6 +2880,9 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
}
}
Builder.addTypeAnnotation(TypeStr);

if (isUnresolvedMemberIdealType(ResultType))
Builder.setSemanticContext(SemanticContextKind::ExpressionSpecific);
};

if (!AFT || IsImplicitlyCurriedInstanceMethod) {
Expand Down Expand Up @@ -3148,6 +3169,9 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
}

addTypeAnnotation(Builder, EnumType);

if (isUnresolvedMemberIdealType(EnumType))
Builder.setSemanticContext(SemanticContextKind::ExpressionSpecific);
}

void addKeyword(StringRef Name, Type TypeAnnotation = Type(),
Expand Down Expand Up @@ -4117,7 +4141,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
auto &SM = CurrDeclContext->getASTContext().SourceMgr;
if (DotLoc.isValid())
bytesToErase = SM.getByteDistance(DotLoc, SM.getCodeCompletionLoc());
addKeyword("nil", T, SemanticContextKind::ExpressionSpecific,
addKeyword("nil", T, SemanticContextKind::None,
CodeCompletionKeywordKind::kw_nil, bytesToErase);
}
getUnresolvedMemberCompletions(T);
Expand Down Expand Up @@ -5755,6 +5779,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
ExprContextInfo ContextInfo(CurDeclContext, CodeCompleteTokenExpr);
Lookup.setExpectedTypes(ContextInfo.getPossibleTypes(),
ContextInfo.isSingleExpressionBody());
Lookup.setIdealExpectedType(CodeCompleteTokenExpr->getType());
Lookup.getUnresolvedMemberCompletions(ContextInfo.getPossibleTypes());
DoPostfixExprBeginning();
break;
Expand Down Expand Up @@ -5810,6 +5835,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
ExprContextInfo ContextInfo(CurDeclContext, CodeCompleteTokenExpr);
Lookup.setExpectedTypes(ContextInfo.getPossibleTypes(),
ContextInfo.isSingleExpressionBody());
Lookup.setIdealExpectedType(CodeCompleteTokenExpr->getType());
Lookup.getUnresolvedMemberCompletions(ContextInfo.getPossibleTypes());
break;
}
Expand Down
7 changes: 7 additions & 0 deletions lib/IDE/CodeCompletionResultBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct ExpectedTypeContext {
/// Possible types of the code completion expression.
llvm::SmallVector<Type, 4> possibleTypes;

/// Pre typechecked type of the expression at the completion position.
Type idealType;

/// Whether the `ExpectedTypes` comes from a single-expression body, e.g.
/// `foo({ here })`.
///
Expand Down Expand Up @@ -136,6 +139,10 @@ class CodeCompletionResultBuilder {
NotRecReason = Reason;
}

void setSemanticContext(SemanticContextKind Kind) {
SemanticContext = Kind;
}

void
setExpectedTypeRelation(CodeCompletionResult::ExpectedTypeRelation relation) {
ExpectedTypeRelation = relation;
Expand Down
4 changes: 2 additions & 2 deletions test/IDE/complete_annotation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ func testImplicitMember() -> MyStruct {
}
// EXPR_IMPLICITMEMBER: Begin completions, 3 items
// EXPR_IMPLICITMEMBER-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Identical]: <name>init</name>(<callarg><callarg.label>x</callarg.label>: <callarg.type><typeid.sys>Int</typeid.sys></callarg.type></callarg>); name=init(x: Int)
// EXPR_IMPLICITMEMBER-DAG: Decl[StaticVar]/CurrNominal/TypeRelation[Identical]: <name>instance</name>; name=instance
// EXPR_IMPLICITMEMBER-DAG: Decl[StaticMethod]/CurrNominal/TypeRelation[Identical]: <name>create</name>(<callarg><callarg.label>x</callarg.label>: <callarg.type><typeid.sys>Int</typeid.sys></callarg.type></callarg>); name=create(x: Int)
// EXPR_IMPLICITMEMBER-DAG: Decl[StaticVar]/ExprSpecific/TypeRelation[Identical]: <name>instance</name>; name=instance
// EXPR_IMPLICITMEMBER-DAG: Decl[StaticMethod]/ExprSpecific/TypeRelation[Identical]: <name>create</name>(<callarg><callarg.label>x</callarg.label>: <callarg.type><typeid.sys>Int</typeid.sys></callarg.type></callarg>); name=create(x: Int)
// EXPR_IMPLICITMEMBER: End completions

func testArgument() -> MyStruct {
Expand Down
4 changes: 2 additions & 2 deletions test/IDE/complete_call_arg.swift
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ func testSubscript(obj: HasSubscript, intValue: Int, strValue: String) {
// SUBSCRIPT_1_DOT: Begin completions
// SUBSCRIPT_1_DOT-NOT: i1
// SUBSCRIPT_1_DOT-NOT: s1
// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/Super: max[#Int#]; name=max
// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/Super: min[#Int#]; name=min
// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/ExprSpecific: max[#Int#]; name=max
// SUBSCRIPT_1_DOT-DAG: Decl[StaticVar]/ExprSpecific: min[#Int#]; name=min

let _ = obj[42, #^SUBSCRIPT_2^#
// SUBSCRIPT_2: Begin completions, 1 items
Expand Down
4 changes: 2 additions & 2 deletions test/IDE/complete_call_as_function.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func testCallAsFunctionOverloaded(fn: Functor) {
//OVERLOADED_ARG2_VALUE: Begin completions, 4 items
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: up[#Functor.Vertical#];
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: down[#Functor.Vertical#];
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: left[#Functor.Horizontal#];
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: right[#Functor.Horizontal#];
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: left[#Functor.Horizontal#];
//OVERLOADED_ARG2_VALUE-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: right[#Functor.Horizontal#];
//OVERLOADED_ARG2_VALUE: End completions
}
4 changes: 2 additions & 2 deletions test/IDE/complete_constrained.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ struct Vegetarian: EatsFruit, EatsVegetables { }
func testVegetarian(chef: Chef<Vegetarian>) {
chef.cook(.#^CONDITIONAL_OVERLOAD_ARG^#)
// CONDITIONAL_OVERLOAD_ARG: Begin completions, 2 items
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: apple[#Fruit#]; name=apple
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: broccoli[#Vegetable#]; name=broccoli
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: apple[#Fruit#]; name=apple
// CONDITIONAL_OVERLOAD_ARG-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: broccoli[#Vegetable#]; name=broccoli
// CONDITIONAL_OVERLOAD_ARG: End completions

var chefMeta: Chef<Vegetarian>.Type = Chef<Vegetarian>.self
Expand Down
32 changes: 16 additions & 16 deletions test/IDE/complete_enum_elements.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ enum FooEnum: CaseIterable {
// FOO_ENUM_TYPE_CONTEXT: Begin completions
// FOO_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Foo1[#FooEnum#]{{; name=.+$}}
// FOO_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Foo2[#FooEnum#]{{; name=.+$}}
// FOO_ENUM_TYPE_CONTEXT-DAG: Decl[StaticVar]/CurrNominal/TypeRelation[Identical]: .alias1[#FooEnum#]; name=alias1
// FOO_ENUM_TYPE_CONTEXT-DAG: Decl[StaticVar]/ExprSpecific/TypeRelation[Identical]: .alias1[#FooEnum#]; name=alias1
// FOO_ENUM_TYPE_CONTEXT: End completions

// FOO_ENUM_NO_DOT: Begin completions
Expand Down Expand Up @@ -130,7 +130,7 @@ enum FooEnum: CaseIterable {
// FOO_ENUM_DOT_ELEMENTS: Begin completions, 3 items
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: Foo1[#FooEnum#]{{; name=.+$}}
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: Foo2[#FooEnum#]{{; name=.+$}}
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[StaticVar]/CurrNominal/TypeRelation[Identical]: alias1[#FooEnum#]; name=alias1
// FOO_ENUM_DOT_ELEMENTS-NEXT: Decl[StaticVar]/ExprSpecific/TypeRelation[Identical]: alias1[#FooEnum#]; name=alias1
// FOO_ENUM_DOT_ELEMENTS-NEXT: End completions

enum BarEnum {
Expand All @@ -154,18 +154,18 @@ enum BarEnum {
}

// BAR_ENUM_TYPE_CONTEXT: Begin completions
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar1[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar2()[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar3({#Int#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar4({#a: Int#}, {#b: Float#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar5({#a: Int#}, {#(Float)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar6({#a: Int#}, {#b: (Float)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar7({#a: Int#}, {#(b: Float, c: Double)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar8({#a: Int#}, {#b: (c: Float, d: Double)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar9({#Int#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar10({#Int#}, {#Float#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar11({#Int#}, {#(Float)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: .Bar12({#Int#}, {#(Float, Double)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar1[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar2()[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar3({#Int#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar4({#a: Int#}, {#b: Float#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar5({#a: Int#}, {#(Float)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar6({#a: Int#}, {#b: (Float)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar7({#a: Int#}, {#(b: Float, c: Double)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar8({#a: Int#}, {#b: (c: Float, d: Double)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar9({#Int#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar10({#Int#}, {#Float#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar11({#Int#}, {#(Float)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: .Bar12({#Int#}, {#(Float, Double)#})[#BarEnum#]{{; name=.+$}}
// BAR_ENUM_TYPE_CONTEXT: End completions

// BAR_ENUM_NO_DOT: Begin completions
Expand Down Expand Up @@ -220,8 +220,8 @@ enum BazEnum<T> {
}

// BAZ_ENUM_TYPE_CONTEXT: Begin completions
// BAZ_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific: .Baz1[#BazEnum<Int>#]{{; name=.+$}}
// BAZ_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/ExprSpecific: .Baz2({#Int#})[#BazEnum<Int>#]{{; name=.+$}}
// BAZ_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal: .Baz1[#BazEnum<Int>#]{{; name=.+$}}
// BAZ_ENUM_TYPE_CONTEXT-DAG: Decl[EnumElement]/CurrNominal: .Baz2({#Int#})[#BazEnum<Int>#]{{; name=.+$}}
// BAZ_ENUM_TYPE_CONTEXT: End completions

// BAZ_INT_ENUM_NO_DOT: Begin completions, 8 items
Expand Down
4 changes: 2 additions & 2 deletions test/IDE/complete_property_delegate_attribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ struct TestStruct {
@MyStruct(arg1: .#^ARG_MyEnum_DOT^#
var test3
// ARG_MyEnum_DOT: Begin completions, 2 items
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: east[#MyEnum#]; name=east
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: west[#MyEnum#]; name=west
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: east[#MyEnum#]; name=east
// ARG_MyEnum_DOT-DAG: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: west[#MyEnum#]; name=west
// ARG_MyEnum_DOT: End completions

@MyStruct(arg1: MyEnum.#^ARG_MyEnum_NOBINDING^#)
Expand Down
15 changes: 10 additions & 5 deletions test/IDE/complete_single_expression_return.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureRetUnresolved | %FileCheck %s -check-prefix=TestSingleExprClosureRetUnresolved
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosure | %FileCheck %s -check-prefix=TestSingleExprClosure
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureVoid | %FileCheck %s -check-prefix=TestSingleExprClosureVoid
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureUnresolved | %FileCheck %s -check-prefix=TestSingleExprClosureRetUnresolved
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureUnresolved | %FileCheck %s -check-prefix=TestSingleExprClosureUnresolved
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureCall | %FileCheck %s -check-prefix=TestSingleExprClosure
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestSingleExprClosureGlobal | %FileCheck %s -check-prefix=TestSingleExprClosureGlobal
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=TestNonSingleExprClosureGlobal | %FileCheck %s -check-prefix=TestNonSingleExprClosureGlobal
Expand Down Expand Up @@ -151,6 +151,11 @@ struct TestSingleExprClosureUnresolved {
}()
}
}
// TestSingleExprClosureUnresolved: Begin completions
// TestSingleExprClosureUnresolved-NOT: notMine
// TestSingleExprClosureUnresolved: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprClosureUnresolved-NOT: notMine
// TestSingleExprClosureUnresolved: End completions

struct TestSingleExprClosureCall {
func void() -> Void {}
Expand Down Expand Up @@ -263,7 +268,7 @@ struct TestSingleExprFuncUnresolved {

// TestSingleExprFuncUnresolved: Begin completions
// TestSingleExprFuncUnresolved-NOT: notMine
// TestSingleExprFuncUnresolved: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprFuncUnresolved: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprFuncUnresolved-NOT: notMine
// TestSingleExprFuncUnresolved: End completions
}
Expand Down Expand Up @@ -373,7 +378,7 @@ struct TestSingleExprAccessorUnresolved {

// TestSingleExprAccessorUnresolved: Begin completions
// TestSingleExprAccessorUnresolved-NOT: notMine
// TestSingleExprAccessorUnresolved: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprAccessorUnresolved: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprAccessorUnresolved-NOT: notMine
// TestSingleExprAccessorUnresolved: End completions
}
Expand Down Expand Up @@ -525,7 +530,7 @@ struct TestSingleExprSubscriptUnresolved {

// TestSingleExprSubscriptUnresolved: Begin completions
// TestSingleExprSubscriptUnresolved-NOT: notMine
// TestSingleExprSubscriptUnresolved: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprSubscriptUnresolved: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: myEnum[#MyEnum#];
// TestSingleExprSubscriptUnresolved-NOT: notMine
// TestSingleExprSubscriptUnresolved: End completions
}
Expand Down Expand Up @@ -630,7 +635,7 @@ enum TopLevelEnum {
case foo
}

// TopLevelEnum: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: foo[#TopLevelEnum#];
// TopLevelEnum: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: foo[#TopLevelEnum#];

var testAccessorUnresolvedTopLevel: TopLevelEnum {
.#^testAccessorUnresolvedTopLevel^#
Expand Down
2 changes: 1 addition & 1 deletion test/IDE/complete_stmt_controlling_expr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func testSwitchCaseWhereExprIJ1(_ fooObject: FooStruct) {
enum A { case aaa }
enum B { case bbb }
// UNRESOLVED_B-NOT: aaa
// UNRESOLVED_B: Decl[EnumElement]/ExprSpecific/TypeRelation[Identical]: bbb[#B#]; name=bbb
// UNRESOLVED_B: Decl[EnumElement]/CurrNominal/TypeRelation[Identical]: bbb[#B#]; name=bbb
// UNRESOLVED_B-NOT: aaa

struct AA {
Expand Down
Loading