Update box tests to 1.2.0-rc-39
This commit is contained in:
committed by
Pavel Punegov
parent
0121b6a185
commit
ffa1ffa659
+57
@@ -0,0 +1,57 @@
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
|
||||
var result = ""
|
||||
|
||||
class A {
|
||||
fun memberFunction() { result += "A.mf," }
|
||||
fun aMemberFunction() { result += "A.amf," }
|
||||
val memberProperty: Int get() = 42.also { result += "A.mp," }
|
||||
val aMemberProperty: Int get() = 42.also { result += "A.amp," }
|
||||
|
||||
fun test(): String {
|
||||
(::memberFunction)()
|
||||
(::aExtensionFunction)()
|
||||
|
||||
(::memberProperty)()
|
||||
(::aExtensionProperty)()
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
inner class B {
|
||||
fun memberFunction() { result += "B.mf," }
|
||||
val memberProperty: Int get() = 42.also { result += "B.mp," }
|
||||
|
||||
fun test(): String {
|
||||
(::aMemberFunction)()
|
||||
(::aExtensionFunction)()
|
||||
|
||||
(::aMemberProperty)()
|
||||
(::aExtensionProperty)()
|
||||
|
||||
(::memberFunction)()
|
||||
(::memberProperty)()
|
||||
|
||||
(::bExtensionFunction)()
|
||||
(::bExtensionProperty)()
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun A.aExtensionFunction() { result += "A.ef," }
|
||||
val A.aExtensionProperty: Int get() = 42.also { result += "A.ep," }
|
||||
fun A.B.bExtensionFunction() { result += "B.ef," }
|
||||
val A.B.bExtensionProperty: Int get() = 42.also { result += "B.ep," }
|
||||
|
||||
fun box(): String {
|
||||
val a = A().test()
|
||||
if (a != "A.mf,A.ef,A.mp,A.ep,") return "Fail $a"
|
||||
|
||||
result = ""
|
||||
val b = A().B().test()
|
||||
if (b != "A.amf,A.ef,A.amp,A.ep,B.mf,B.mp,B.ef,B.ep,") return "Fail $b"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+2
-1
@@ -3,7 +3,8 @@
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
import kotlin.reflect.full.*
|
||||
|
||||
class C {
|
||||
var prop = 42
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
// WITH_REFLECT
|
||||
|
||||
import kotlin.reflect.*
|
||||
import kotlin.reflect.full.*
|
||||
|
||||
class C {
|
||||
fun foo() {}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
fun foo(): Unit {}
|
||||
assert(Unit.javaClass.equals(foo().javaClass))
|
||||
assert(Unit.javaClass.equals(foo()::class.java))
|
||||
return "OK"
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
abstract class A {
|
||||
inner class InnerInA {
|
||||
fun returnOk() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class B : A()
|
||||
|
||||
fun foo(a: A): String {
|
||||
if (a is B) {
|
||||
val v = a::InnerInA
|
||||
return v().returnOk()
|
||||
}
|
||||
|
||||
return "error"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return foo(B())
|
||||
}
|
||||
Reference in New Issue
Block a user