mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
30 lines
352 B
Swift
30 lines
352 B
Swift
// RUN: %target-swift-emit-silgen %s
|
|
|
|
class C {
|
|
func f1() -> Self? {
|
|
return D<Self>().g(self)
|
|
}
|
|
|
|
func f2() -> Self? {
|
|
return D<Self>()[self]
|
|
}
|
|
|
|
func f3() -> Self? {
|
|
return D<Self>().x
|
|
}
|
|
}
|
|
|
|
class D<T> {
|
|
func g(_ t: T) -> T? {
|
|
return t
|
|
}
|
|
|
|
subscript(_ t: T) -> T? {
|
|
return t
|
|
}
|
|
|
|
var x: T? {
|
|
fatalError()
|
|
}
|
|
}
|