KT-4107 Data objects

This commit is contained in:
Pavel Mikhailovskii
2022-06-28 09:51:57 +02:00
parent 6c31dc90e4
commit c3c09aa95a
75 changed files with 1183 additions and 134 deletions
@@ -0,0 +1,44 @@
// FIR_IDENTICAL
// LANGUAGE: +DataObjects
data object Override {
<!DATA_OBJECT_CUSTOM_EQUALS_OR_HASH_CODE!>override<!> fun equals(other: Any?): Boolean {
return true
}
<!DATA_OBJECT_CUSTOM_EQUALS_OR_HASH_CODE!>override<!> fun hashCode(): Int {
return 1
}
}
open class Base {
open fun hashCode(x: Int) = x
}
data object NoOverride: Base() {
fun equals(other: Any?, tag: Int): Boolean {
return true
}
fun hashCode(param: String): Int {
return 1
}
override fun hashCode(x: Int) = x + 1
}
open class Super {
override fun equals(other: Any?): Boolean {
return super.equals(other)
}
override fun hashCode(): Int {
return 1
}
}
data object OverridenInSuper: Super() {
<!DATA_OBJECT_CUSTOM_EQUALS_OR_HASH_CODE!>override<!> fun equals(other: Any?): Boolean {
return super.equals(other)
}
}
@@ -0,0 +1,40 @@
package
public open class Base {
public constructor Base()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open fun hashCode(/*0*/ x: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public data object NoOverride : Base {
private constructor NoOverride()
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun equals(/*0*/ other: kotlin.Any?, /*1*/ tag: kotlin.Int): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ fun hashCode(/*0*/ x: kotlin.Int): kotlin.Int
public final fun hashCode(/*0*/ param: kotlin.String): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public data object Override {
private constructor Override()
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public data object OverridenInSuper : Super {
private constructor OverridenInSuper()
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public open class Super {
public constructor Super()
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}