JVM IR: support noarg compiler plugin
#KT-41265 Fixed
This commit is contained in:
+14
-19
@@ -13,24 +13,19 @@ class Test(val a: String) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
val test = Test::class.java.newInstance()
|
||||
val test = Test::class.java.newInstance()
|
||||
|
||||
if (test.x != 5) {
|
||||
return "Bad 5"
|
||||
}
|
||||
|
||||
if (test.y == null || test.y.a != "Hello, world!") {
|
||||
return "Bad Hello, world!"
|
||||
}
|
||||
|
||||
if (test.z != "TEST") {
|
||||
return "Bad TEST"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
return "Fail"
|
||||
if (test.x != 5) {
|
||||
return "Bad 5"
|
||||
}
|
||||
}
|
||||
|
||||
if (test.y == null || test.y.a != "Hello, world!") {
|
||||
return "Bad Hello, world!"
|
||||
}
|
||||
|
||||
if (test.z != "TEST") {
|
||||
return "Bad TEST"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+10
-15
@@ -11,20 +11,15 @@ class Test(val a: String) {
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
val test = Test::class.java.newInstance()
|
||||
val test = Test::class.java.newInstance()
|
||||
|
||||
if (test.x != 0) {
|
||||
return "Bad 5"
|
||||
}
|
||||
|
||||
if (test.y != null) {
|
||||
return "Bad Hello, world!"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
} catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
return "Fail"
|
||||
if (test.x != 0) {
|
||||
return "Bad 5"
|
||||
}
|
||||
}
|
||||
|
||||
if (test.y != null) {
|
||||
return "Bad Hello, world!"
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// WITH_RUNTIME
|
||||
// INVOKE_INITIALIZERS
|
||||
|
||||
annotation class NoArg
|
||||
|
||||
@NoArg
|
||||
class Test(val a: String) {
|
||||
val lc = run {
|
||||
class Local(val result: String)
|
||||
Local("OK").result
|
||||
}
|
||||
|
||||
val obj = object { val result = "OK" }.result
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = Test::class.java.newInstance()
|
||||
if (t.lc != "OK") return "Fail 1"
|
||||
return t.obj
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
annotation class NoArg
|
||||
|
||||
class Outer {
|
||||
@NoArg
|
||||
class Nested(val a: String)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Outer.Nested::class.java.newInstance()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+3
-7
@@ -6,10 +6,6 @@ annotation class NoArg
|
||||
class Test(val a: String)
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
Test::class.java.newInstance()
|
||||
return "OK"
|
||||
} catch (_: Throwable) {
|
||||
return "Fail"
|
||||
}
|
||||
}
|
||||
Test::class.java.newInstance()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user