Files
swift-mirror/test/SILGen/concrete_subclass.swift
Alex Hoppen 560c22b18e [tests] Verify the libSyntax tree on SILGen tests
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.
2018-04-27 09:33:03 -07:00

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