Files
swift-mirror/test/IDE/complete_from_stdlib.swift
Ben Langmuir fff41e472e Hide _UnderscoredProtocols in code completion
We explicitly whitelist these "stdlib private" decls in interface
generation, because they may contain methods that users are required to
implement.  But in code-completion, there's no good reason to show them.
We still show completions for the methods themselves if you complete on
a public protocol that inherits from the private protocol. So,

<complete> => doesn't show _CollectionType

let a: CollectionType = ...
a.<complete> => *does* show startIndex, which comes from _CollectionType

rdar://problem/20086106

Swift SVN r26355
2015-03-20 17:14:08 +00:00

39 lines
1.7 KiB
Swift

// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PLAIN_TOP_LEVEL_1 > %t.toplevel.txt
// RUN: FileCheck %s -check-prefix=PLAIN_TOP_LEVEL < %t.toplevel.txt
// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.toplevel.txt
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_NOMINAL_MEMBERS_1 > %t.members.txt
// RUN: FileCheck %s -check-prefix=PRIVATE_NOMINAL_MEMBERS_1 < %t.members.txt
// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.members.txt
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=PRIVATE_PROTOCOL_MEMBERS_1 > %t.protocol.members.txt
// RUN: FileCheck %s -check-prefix=PRIVATE_PROTOCOL_MEMBERS_1 < %t.protocol.members.txt
// RUN: FileCheck %s -check-prefix=NO_STDLIB_PRIVATE < %t.protocol.members.txt
// NO_STDLIB_PRIVATE: Begin completions
// NO_STDLIB_PRIVATE-NOT: Decl[{{.*}}]{{[^:]*}}: _
// NO_STDLIB_PRIVATE: End completions
#^PLAIN_TOP_LEVEL_1^#
// PLAIN_TOP_LEVEL: Begin completions
// PLAIN_TOP_LEVEL-DAG: Decl[Struct]/OtherModule[Swift]: Array[#Array#]{{; name=.+$}}
// PLAIN_TOP_LEVEL: End completions
func privateNominalMembers(a: String) {
a.#^PRIVATE_NOMINAL_MEMBERS_1^#
}
// PRIVATE_NOMINAL_MEMBERS_1: Begin completions
// PRIVATE_NOMINAL_MEMBERS_1-DAG: Decl[InstanceVar]/CurrNominal: startIndex[#String.Index#]{{; name=.+$}}
// PRIVATE_NOMINAL_MEMBERS_1: End completions
func privateProtocolMembers(a: CollectionType) {
a.#^PRIVATE_PROTOCOL_MEMBERS_1^#
}
// PRIVATE_PROTOCOL_MEMBERS_1: Begin completions
// PRIVATE_PROTOCOL_MEMBERS_1-DAG: Decl[InstanceVar]/Super: startIndex[#Self.Index#]
// PRIVATE_PROTOCOL_MEMBERS_1: End completions