Prohibit @JvmRecord for non-data classes

^KT-43677 In Progress
This commit is contained in:
Denis.Zharkov
2020-11-30 20:20:14 +03:00
parent cc0b584445
commit c8851c4f75
11 changed files with 92 additions and 53 deletions
@@ -10,7 +10,7 @@ public class JavaClass {
// FILE: main.kt
@JvmRecord
class MyRec<R>(val x: String, val y: R)
data class MyRec<R>(val x: String, val y: R)
fun box(): String {
val recordComponents = MyRec::class.java.recordComponents
@@ -0,0 +1,16 @@
// !LANGUAGE: +JvmRecordSupport
// JVM_TARGET: 15_PREVIEW
@JvmRecord
data class MyRec<R>(val x: String, val y: R)
fun box(): String {
val m1 = MyRec("O", "K")
val m2 = MyRec("O", "K")
if (m1 != m2) return "fail 1"
if (m1.hashCode() != m2.hashCode()) return "fail 2"
if (m1.toString() != "MyRec(x=O, y=K)") return "fail 3: $m1"
return "OK"
}