File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -3730,11 +3730,15 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
3730
3730
Kind = LookupKind::Type;
3731
3731
this ->BaseType = BaseType;
3732
3732
NeedLeadingDot = !HaveDot;
3733
- Type MetaBase = MetatypeType::get (BaseType);
3734
- lookupVisibleMemberDecls (*this , MetaBase,
3733
+ lookupVisibleMemberDecls (*this , MetatypeType::get (BaseType),
3735
3734
CurrDeclContext, TypeResolver,
3736
3735
IncludeInstanceMembers);
3737
- addKeyword (" Type" , MetaBase);
3736
+ if (BaseType->isAnyExistentialType ()) {
3737
+ addKeyword (" Protocol" , MetatypeType::get (BaseType));
3738
+ addKeyword (" Type" , ExistentialMetatypeType::get (BaseType));
3739
+ } else {
3740
+ addKeyword (" Type" , MetatypeType::get (BaseType));
3741
+ }
3738
3742
}
3739
3743
3740
3744
static bool canUseAttributeOnDecl (DeclAttrKind DAK, bool IsInSil,
Original file line number Diff line number Diff line change 396
396
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_ARGS_LOCAL_PARAM | %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES
397
397
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=GENERIC_ARGS_LOCAL_RETURN | %FileCheck %s -check-prefix=WITH_GLOBAL_TYPES
398
398
399
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_DOT_1 | %FileCheck %s -check-prefix=PROTOCOL_DOT_1
400
+
399
401
//===--- Helper types that are used in this test
400
402
401
403
struct FooStruct {
@@ -1082,3 +1084,12 @@ func _testForGenericArg_() {
1082
1084
func foo1( x: GenStruct< #^GENERIC_ARGS_LOCAL_PARAM^#
1083
1085
func foo2( ) -> GenStruct< #^GENERIC_ARGS_LOCAL_RETURN^#
1084
1086
}
1087
+
1088
+ func testProtocol( ) {
1089
+ let _: FooProtocol . #^PROTOCOL_DOT_1 ^#
1090
+ // PROTOCOL_DOT_1: Begin completions, 3 items
1091
+ // PROTOCOL_DOT_1-DAG: Decl[AssociatedType]/CurrNominal: FooTypeAlias1; name=FooTypeAlias1
1092
+ // PROTOCOL_DOT_1-DAG: Keyword/None: Protocol[#FooProtocol.Protocol#]; name=Protocol
1093
+ // PROTOCOL_DOT_1-DAG: Keyword/None: Type[#FooProtocol.Type#]; name=Type
1094
+ // PROTOCOL_DOT_1: End completions
1095
+ }
You can’t perform that action at this time.
0 commit comments