TEST: constructor body test
This commit is contained in:
committed by
vvlevchenko
parent
4d24d735de
commit
81742556a6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
var field0:Int = 0;
|
||||
constructor(arg0:Int) {
|
||||
field0 = arg0
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ int
|
||||
run_test() {
|
||||
int (*foo)(int, int) = resolve_symbol("kfun:foo(Int;Int)");
|
||||
|
||||
if (foo(2, 3) != 2) return 1;
|
||||
if (foo(2, 3) != 5) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,19 @@ open class A(val a:Int, val b:Int)
|
||||
|
||||
open class B(val c:Int, d:Int):A(c, d)
|
||||
|
||||
//class C():B(42)
|
||||
open class C(i:Int, j:Int):B(i + j, 42)
|
||||
|
||||
class D (i: Int, j:Int) : C(i, j){
|
||||
constructor(i: Int, j:Int, k:Int) : this(i, j) {
|
||||
foo(i)
|
||||
}
|
||||
constructor():this(1, 2)
|
||||
}
|
||||
|
||||
fun foo(i:Int) : Unit {}
|
||||
|
||||
|
||||
fun foo(i:Int, j:Int):Int {
|
||||
val b = B(i, j)
|
||||
return b.c
|
||||
val c = D(i, j)
|
||||
return c.c
|
||||
}
|
||||
Reference in New Issue
Block a user