mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
in typechecked AST. This is needed to correctly get the type of the parsed expression when the expression is a calling to a method in super class returning 'Self'. rdar://problem/51504896
21 lines
801 B
Swift
21 lines
801 B
Swift
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COVARIANT_RETURN_CONV | %FileCheck %s --check-prefix=COVARIANT_RETURN_CONV
|
|
|
|
class BaseClass {
|
|
func returnSelf() -> Self {}
|
|
}
|
|
|
|
class DerivedClass: BaseClass {
|
|
var value: Int
|
|
func foo() {}
|
|
}
|
|
|
|
func test(value: DerivedClass) {
|
|
value.returnSelf().#^COVARIANT_RETURN_CONV^#
|
|
// COVARIANT_RETURN_CONV: Begin completions, 4 items
|
|
// COVARIANT_RETURN_CONV-DAG: Keyword[self]/CurrNominal: self[#DerivedClass#];
|
|
// COVARIANT_RETURN_CONV-DAG: Decl[InstanceVar]/CurrNominal: value[#Int#];
|
|
// COVARIANT_RETURN_CONV-DAG: Decl[InstanceMethod]/CurrNominal: foo()[#Void#];
|
|
// COVARIANT_RETURN_CONV-DAG: Decl[InstanceMethod]/Super: returnSelf()[#Self#];
|
|
// COVARIANT_RETURN_CONV: End completions
|
|
}
|