JVM: Generate equals-impl0 method for inline classes
This commit is contained in:
committed by
Alexander Udalov
parent
2c7da67600
commit
f53b28e8a3
+3
-7
@@ -15,11 +15,7 @@ fun box(): String {
|
||||
Simple::class.java.getDeclaredMethod(name, String::class.java, String::class.java)
|
||||
?: return "$name not found"
|
||||
|
||||
val result = try {
|
||||
specializedEquals.invoke(null, "a", "b")
|
||||
} catch (e: InvocationTargetException) {
|
||||
return if (e.targetException is NullPointerException) "OK" else "${e.targetException}"
|
||||
}
|
||||
|
||||
return if (result == false) "OK" else "Fail"
|
||||
if (specializedEquals.invoke(null, "a", "b") as Boolean)
|
||||
return "Fail"
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
inline class AsNonNullPrimitive(val i: Int)
|
||||
inline class AsNonNullReference(val s: String)
|
||||
// ^ JVM: 5 assertions (constructor, box method, erased constructor, 2 assertions in equals--impl)
|
||||
// ^ JVM: 3 assertions (constructor, box method, erased constructor)
|
||||
// JVM IR: 1 assertion (erased constructor)
|
||||
|
||||
fun nonNullPrimitive(a: AsNonNullPrimitive) {}
|
||||
@@ -14,7 +14,7 @@ fun asNullablePrimitive(c: AsNonNullPrimitive?) {}
|
||||
fun asNullableReference(c: AsNonNullReference?) {}
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 8 checkParameterIsNotNull
|
||||
// 6 checkParameterIsNotNull
|
||||
// 0 checkNotNullParameter
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
|
||||
Reference in New Issue
Block a user