mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The SILGen testsuite consists of valid Swift code covering most language features. We use these tests to verify that no unknown nodes are in the file's libSyntax tree. That way we will (hopefully) catch any future changes or additions to the language which are not implemented in libSyntax.
39 lines
654 B
Swift
39 lines
654 B
Swift
// RUN: %target-swift-emit-silgen -Xllvm -sil-full-demangle %s
|
|
|
|
class BaseClass<T> {
|
|
func inAndOut(_ t: T) -> T { return t }
|
|
var property: T
|
|
|
|
init(_ t: T) {
|
|
self.property = t
|
|
}
|
|
}
|
|
|
|
class DerivedClass : BaseClass<(Int, Int)> {
|
|
override func inAndOut(_ t: (Int, Int)) -> (Int, Int) {
|
|
let fn = super.inAndOut
|
|
return fn(t)
|
|
}
|
|
|
|
override var property: (Int, Int) {
|
|
get {
|
|
return super.property
|
|
}
|
|
set {
|
|
super.property = newValue
|
|
}
|
|
}
|
|
|
|
override init(_ t: (Int, Int)) {
|
|
super.init(t)
|
|
}
|
|
}
|
|
|
|
let d = DerivedClass((1, 2))
|
|
_ = d.inAndOut((1, 2))
|
|
|
|
let value = d.property
|
|
d.property = value
|
|
|
|
d.property.0 += 1
|