Migrate boxInline tests to new multi-file framework
This commit is contained in:
committed by
Alexander Udalov
parent
fa1f7d988e
commit
cc84aabdcf
@@ -0,0 +1,43 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class B<T>
|
||||
|
||||
interface A {
|
||||
fun <T> aTest(p: T): B<T>
|
||||
}
|
||||
|
||||
open class Test {
|
||||
|
||||
inline fun <T> test(crossinline z: () -> Int) = object : A {
|
||||
override fun <T> aTest(p: T): B<T> {
|
||||
z()
|
||||
return B<T>()
|
||||
}
|
||||
}
|
||||
|
||||
fun callInline() = test<String> { 1 }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
// NO_CHECK_LAMBDA_INLINING
|
||||
// FULL_JDK
|
||||
|
||||
import test.*
|
||||
import java.util.*
|
||||
|
||||
|
||||
fun box(): String {
|
||||
val result = Test().callInline()
|
||||
val method = result.javaClass.getMethod("aTest", Any::class.java)
|
||||
val genericReturnType = method.genericReturnType
|
||||
if (genericReturnType.toString() != "test.B<T>") return "fail 1: ${genericReturnType}"
|
||||
|
||||
val genericParameterTypes = method.genericParameterTypes
|
||||
if (genericParameterTypes.size != 1) return "fail 2: ${genericParameterTypes.size}"
|
||||
if (genericParameterTypes[0].toString() != "T") return "fail 3: ${genericParameterTypes[0]}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user