1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OBJECT_DOT_1 | %FileCheck %s -check-prefix=FOO_OBJECT_DOT
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=BAR_OBJECT_DOT_1 | %FileCheck %s -check-prefix=BAR_OBJECT_DOT
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CATCHSEQUENCE_DOT | %FileCheck %s -check-prefix=CATCHSEQUENCE_DOT
protocol FooBaseProtocol {
var instanceProperty: Int { get }
}
protocol FooRefinedProtocol : FooBaseProtocol {}
protocol FooMoreRefinedProtocol : FooRefinedProtocol {}
protocol FooEvenMoreRefinedProtocol : FooRefinedProtocol {}
struct FooStruct : FooMoreRefinedProtocol {
var instanceProperty: Int { return 0 }
}
// FOO_OBJECT_DOT: Begin completions, 2 items
// FOO_OBJECT_DOT-DAG: Keyword[self]/CurrNominal: self[#FooStruct#]; name=self
// FOO_OBJECT_DOT-DAG: Decl[InstanceVar]/CurrNominal: instanceProperty[#Int#]
struct BarStruct : FooEvenMoreRefinedProtocol {
var instanceProperty: Int { return 0 }
}
// BAR_OBJECT_DOT: Begin completions, 2 items
// BAR_OBJECT_DOT-DAG: Keyword[self]/CurrNominal: self[#BarStruct#]; name=self
// BAR_OBJECT_DOT-DAG: Decl[InstanceVar]/CurrNominal: instanceProperty[#Int#]
func test(a: FooStruct) {
a.#^FOO_OBJECT_DOT_1^#
}
func test(a: BarStruct) {
a.#^BAR_OBJECT_DOT_1^#
}
protocol ObservableConvertibleType {
associatedtype T
}
class Observable<T> : ObservableConvertibleType {}
class CatchSequence<S: Sequence>: Observable<S.Element.T> where S.Element: ObservableConvertibleType {}
extension ObservableConvertibleType {
static func catchError() -> Observable<T> {
return CatchSequence.#^CATCHSEQUENCE_DOT^#
}
}
// CATCHSEQUENCE_DOT-DAG: Keyword[self]/CurrNominal: self[#CatchSequence<_>.Type#]; name=self
// CATCHSEQUENCE_DOT-DAG: Keyword/CurrNominal: Type[#CatchSequence<_>.Type#]; name=Type
// CATCHSEQUENCE_DOT-DAG: Decl[Constructor]/CurrNominal/TypeRelation[Convertible]: init()[#CatchSequence<_>#]; name=init()
// CATCHSEQUENCE_DOT-DAG: Decl[StaticMethod]/Super/TypeRelation[Convertible]: catchError()[#Observable<CatchSequence<_>.T>#]; name=catchError()
// CATCHSEQUENCE_DOT-DAG: Decl[TypeAlias]/Super: T[#T#]; name=T
|