File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -3968,6 +3968,11 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
3968
3968
DeclVisibilityKind::GenericParameter, {});
3969
3969
}
3970
3970
3971
+ // For non-protocol nominal type decls, only suggest generic parameters.
3972
+ if (auto D = DC->getAsDecl ())
3973
+ if (isa<NominalTypeDecl>(D) && !isa<ProtocolDecl>(D))
3974
+ return ;
3975
+
3971
3976
auto typeContext = DC->getInnermostTypeContext ();
3972
3977
if (!typeContext)
3973
3978
return ;
Original file line number Diff line number Diff line change 32
32
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL | %FileCheck %s -check-prefix=PROTOCOL
33
33
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_EXT | %FileCheck %s -check-prefix=PROTOCOL
34
34
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PROTOCOL_SELF | %FileCheck %s -check-prefix=PROTOCOL_SELF
35
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NOMINAL_TYPEALIAS | %FileCheck %s -check-prefix=NOMINAL_TYPEALIAS
36
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=NOMINAL_TYPEALIAS_EXT | %FileCheck %s -check-prefix=NOMINAL_TYPEALIAS_EXT
35
37
36
38
class A1 < T1, T2, T3> { }
37
39
@@ -177,3 +179,15 @@ protocol P4 where Self.#^PROTOCOL_SELF^# {
177
179
// PROTOCOL_SELF-DAG: Decl[TypeAlias]/CurrNominal: IntAlias[#Int#];
178
180
// PROTOCOL_SELF-DAG: Keyword/None: Type[#Self.Type#];
179
181
// PROTOCOL_SELF: End completions
182
+
183
+ struct TA1 < T: Assoc > where #^NOMINAL_TYPEALIAS^# {
184
+ typealias U = T . Q
185
+ }
186
+ // NOMINAL_TYPEALIAS: Begin completions, 1 items
187
+ // NOMINAL_TYPEALIAS-DAG: Decl[GenericTypeParam]/Local: T[#T#];
188
+ // NOMINAL_TYPEALIAS: End completions
189
+ extension TA1 where #^NOMINAL_TYPEALIAS_EXT^# { }
190
+ // NOMINAL_TYPEALIAS_EXT: Begin completions, 2 items
191
+ // NOMINAL_TYPEALIAS_EXT-DAG: Decl[GenericTypeParam]/Local: T[#T#];
192
+ // NOMINAL_TYPEALIAS_EXT-DAG: Decl[TypeAlias]/CurrNominal: U[#T.Q#];
193
+ // NOMINAL_TYPEALIAS_EXT: End completions
You can’t perform that action at this time.
0 commit comments