Test for obsolete KT-6988: java.lang.VerifyError: Bad return caused by inline reified
#KT-6988 Obsolete
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import test.*
|
||||
|
||||
public class A()
|
||||
|
||||
fun box(): String {
|
||||
val s = "yo".inlineMeIfYouCan<A>()().call()
|
||||
if (s !is A) return "fail"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
interface Call<T> {
|
||||
fun call(): T
|
||||
}
|
||||
|
||||
public inline fun <reified T: Any> Any.inlineMeIfYouCan() : () -> Call<T> = {
|
||||
object : Call<T> {
|
||||
override fun call() = T::class.java.newInstance()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
"yo".inlineMeIfYouCan<StringBuilder>()().run()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package test
|
||||
|
||||
|
||||
public inline fun <reified T: Any> Any.inlineMeIfYouCan() : () -> Runnable = {
|
||||
object : Runnable {
|
||||
override fun run() {
|
||||
javaClass<T>().newInstance()
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -1072,6 +1072,18 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6988.1.kt")
|
||||
public void testKt6988() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6988_2.1.kt")
|
||||
public void testKt6988_2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt");
|
||||
doTestMultiFileWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("packages.1.kt")
|
||||
public void testPackages() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/packages.1.kt");
|
||||
|
||||
+12
@@ -1072,6 +1072,18 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6988.1.kt")
|
||||
public void testKt6988() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt6988_2.1.kt")
|
||||
public void testKt6988_2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/kt6988_2.1.kt");
|
||||
doBoxTestWithInlineCheck(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("packages.1.kt")
|
||||
public void testPackages() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/reified/packages.1.kt");
|
||||
|
||||
Reference in New Issue
Block a user