IR: consolidate generation of synthetic members for data class

This commit is contained in:
Jinseong Jeon
2020-04-12 23:08:50 -07:00
committed by Mikhail Glukhikh
parent 1500131eb0
commit c370b86141
54 changed files with 1760 additions and 415 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: Int) {
override fun equals(other: Any?): Boolean = false
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val v: Array<Int>)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val v: IntArray)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: Int) {
override fun hashCode(): Int = -3
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Boolean)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Byte)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Char)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Double)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Float)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A<T>(val t: T)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Int)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Long)
fun box() : String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val a: Short)
fun box() : String {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
import java.io.Serializable
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
abstract class Base {
final override fun toString() = "OK"
final override fun hashCode() = 42
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// See KT-6206 Always generate hashCode() and equals() for data classes even if base classes have non-trivial analogs
abstract class Base {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class D(private val x: Long, private val y: Char) {
fun foo() = "${component1()}${component2()}"
}
@@ -1,3 +1,4 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: Int) {
override fun toString(): String = "!"
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS_IR
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(var string: String)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A<T>(val x: T)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(var x: Int, val z: Int?)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
data class A(val x: Unit)
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_RUNTIME