Files
swift-mirror/test/Interpreter/super_constructor.swift
Joe Groff 637c4e8171 Fold Interpreter and Interpreter/SIL tests.
There is only SIL. No reason to keep a subdirectory around.

Swift SVN r6029
2013-07-05 23:11:44 +00:00

54 lines
809 B
Swift

// RUN: %swift -i %s | FileCheck %s
struct S {
var a, b : Int
constructor(a : Int, b : Int) {
this.a = a
this.b = b
}
constructor(x:Char) {
a = 219
b = 912
println("constructed \(x)")
}
}
class C {
var a, b : Int
constructor(x:Char) {
a = 20721
b = 12702
println("constructed \(x)")
}
}
class D : C {
constructor() {
super.constructor('z')
println("...in bed")
}
}
func println(s:S) {
println("S(a=\(s.a), b=\(s.b))")
}
func println(c:C) {
println("C(a=\(c.a), b=\(c.b))")
}
// CHECK: S(a=1, b=2)
println(S(1, 2))
// CHECK: constructed x
// CHECK: S(a=219, b=912)
println(S('x'))
// CHECK: constructed y
// CHECK: C(a=20721, b=12702)
println(C('y'))
// CHECK: constructed z
// CHECK: ...in bed
// CHECK: C(a=20721, b=12702)
println(D())