A couple of new tests
for boxing
and for body assignment in an interface
This commit is contained in:
committed by
alexander-gorshenev
parent
2a0d01191a
commit
268e3b26c0
@@ -397,3 +397,16 @@ task throw0(type: RunKonanTest) {
|
||||
goldValue = "Done\n"
|
||||
source = "runtime/basic/throw0.kt"
|
||||
}
|
||||
/*
|
||||
task boxing0(type: RunKonanTest) {
|
||||
goldValue = "17\n"
|
||||
source = "runtime/basic/boxing0.kt"
|
||||
}
|
||||
*/
|
||||
/*
|
||||
task interface0(type: RunKonanTest) {
|
||||
goldValue = "PASS\n"
|
||||
source = "runtime/basic/interface0.kt"
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
class Box<T>(t: T) {
|
||||
var value = t
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val box: Box<Int> = Box<Int>(17)
|
||||
println(box.value)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
interface A {
|
||||
fun b() = c()
|
||||
fun c()
|
||||
}
|
||||
|
||||
class B(): A {
|
||||
override fun c() {
|
||||
println("PASSED")
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val a:A = B()
|
||||
a.b()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user