[IR] Support user-defined equals for MFVC

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
This commit is contained in:
Evgeniy.Zhelenskiy
2022-10-14 07:17:03 +02:00
committed by Space Team
parent 51f9f31a0a
commit 9f01ccc304
75 changed files with 1686 additions and 315 deletions
@@ -1,7 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
interface I {
@@ -52,4 +55,4 @@ value class IC2(val y: Int) : I {
}
}
fun box(): String = if (setOf(IC1(10), IC2(1)).size == 1) "OK" else "Fail"
fun box(): String = if (setOf(IC1(10), IC2(1)).size == 1) "OK" else "Fail"
@@ -0,0 +1,55 @@
@kotlin.Metadata
public interface I {
// source: 'inlineClassBothEqualsOverride.kt'
public abstract method getVal(): int
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC1 {
// source: 'inlineClassBothEqualsOverride.kt'
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): IC1
public static method constructor-impl(p0: int): int
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final static method equals-P1kVloU(p0: int, p1: int): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public method getVal(): int
public static method getVal-impl(p0: int): int
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public method toString(): java.lang.String
public static method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC2 {
// source: 'inlineClassBothEqualsOverride.kt'
private final field y: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): IC2
public static method constructor-impl(p0: int): int
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final static method equals-ACFGG4I(p0: int, p1: int): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public method getVal(): int
public static method getVal-impl(p0: int): int
public final method getY(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public method toString(): java.lang.String
public static method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}
@kotlin.Metadata
public final class InlineClassBothEqualsOverrideKt {
// source: 'inlineClassBothEqualsOverride.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,7 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import java.lang.AssertionError
import kotlin.math.abs
@@ -44,4 +47,4 @@ fun box(): String {
if ((a2Typed == c2Typed) != (a2Untyped == c2Untyped)) return "Fail 4"
return "OK"
}
}
@@ -0,0 +1,44 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC1 {
// source: 'inlineClassEqualsConsistency.kt'
private final field x: double
private synthetic method <init>(p0: double): void
public synthetic final static method box-impl(p0: double): IC1
public static method constructor-impl(p0: double): double
public method equals(p0: java.lang.Object): boolean
public final static method equals-P1kVloU(p0: double, p1: double): boolean
public static method equals-impl(p0: double, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: double, p1: double): boolean
public final method getX(): double
public method hashCode(): int
public static method hashCode-impl(p0: double): int
public method toString(): java.lang.String
public static method toString-impl(p0: double): java.lang.String
public synthetic final method unbox-impl(): double
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC2 {
// source: 'inlineClassEqualsConsistency.kt'
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): IC2
public static method constructor-impl(p0: int): int
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public method toString(): java.lang.String
public static method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}
@kotlin.Metadata
public final class InlineClassEqualsConsistencyKt {
// source: 'inlineClassEqualsConsistency.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,7 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import kotlin.math.abs
@@ -19,4 +22,4 @@ value class IC(val x: Double) {
fun box(): String {
val set = setOf(IC(1.0), IC(1.5), IC(1.501))
return if (set.size == 2) "OK" else "Fail"
}
}
@@ -0,0 +1,25 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC {
// source: 'inlineClassEqualsOverriddenForCollections.kt'
private final field x: double
private synthetic method <init>(p0: double): void
public synthetic final static method box-impl(p0: double): IC
public static method constructor-impl(p0: double): double
public method equals(p0: java.lang.Object): boolean
public final static method equals-K5cTq2M(p0: double, p1: double): boolean
public static method equals-impl(p0: double, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: double, p1: double): boolean
public final method getX(): double
public method hashCode(): int
public static method hashCode-impl(p0: double): int
public method toString(): java.lang.String
public static method toString-impl(p0: double): java.lang.String
public synthetic final method unbox-impl(): double
}
@kotlin.Metadata
public final class InlineClassEqualsOverriddenForCollectionsKt {
// source: 'inlineClassEqualsOverriddenForCollections.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,6 +1,8 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
@@ -93,4 +95,4 @@ fun box() = when {
else -> "OK"
}
}
@@ -1,6 +1,9 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// CHECK_BYTECODE_LISTING
OPTIONAL_JVM_INLINE_ANNOTATION
value class A(val value: MyClass) {
@@ -11,4 +14,4 @@ class MyClass() {
override fun hashCode() = -1
}
fun box(): String = if (A(MyClass()).hashCode() == 42) "OK" else "Fail"
fun box(): String = if (A(MyClass()).hashCode() == 42) "OK" else "Fail"
@@ -0,0 +1,31 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class A {
// source: 'inlineClassHashCodeOverride.kt'
private final @org.jetbrains.annotations.NotNull field value: MyClass
private synthetic method <init>(p0: MyClass): void
public synthetic final static method box-impl(p0: MyClass): A
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: MyClass): MyClass
public method equals(p0: java.lang.Object): boolean
public static method equals-impl(p0: MyClass, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: MyClass, p1: MyClass): boolean
public final @org.jetbrains.annotations.NotNull method getValue(): MyClass
public method hashCode(): int
public static method hashCode-impl(p0: MyClass): int
public method toString(): java.lang.String
public static method toString-impl(p0: MyClass): java.lang.String
public synthetic final method unbox-impl(): MyClass
}
@kotlin.Metadata
public final class InlineClassHashCodeOverrideKt {
// source: 'inlineClassHashCodeOverride.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@kotlin.Metadata
public final class MyClass {
// source: 'inlineClassHashCodeOverride.kt'
public method <init>(): void
public method hashCode(): int
}
@@ -1,12 +1,13 @@
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC1<T : Number>(val x: T) {
fun equals(other: Int) = false
operator fun equals(other: IC1<*>) = true
fun equals(other: IC1<*>) = true
}
class Generic<T, R>(val x: T, val y: R)
@@ -14,19 +15,19 @@ class Generic<T, R>(val x: T, val y: R)
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC2<T, R>(val value: Generic<T, R>) {
fun equals(other: IC1<Double>) = false
operator fun equals(other: IC2<*, *>) = true
fun equals(other: IC2<*, *>) = true
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC3<T>(val value: T) {
fun equals(other: Int) = false
operator fun equals(other: IC3<*>) = true
fun equals(other: IC3<*>) = true
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class IC4<T>(val value: T) {
fun equals(other: String) = false
operator fun equals(other: IC4<*>) = true
fun equals(other: IC4<*>) = true
}
@@ -52,4 +53,4 @@ fun box() = when {
(IC4("aba") as Any) != (IC4("caba") as Any) -> "Fail 4.4"
else -> "OK"
}
}
@@ -0,0 +1,99 @@
@kotlin.Metadata
public final class Generic {
// source: 'inlineClassTypedEqualsGenerics.kt'
private final field x: java.lang.Object
private final field y: java.lang.Object
public method <init>(p0: java.lang.Object, p1: java.lang.Object): void
public final method getX(): java.lang.Object
public final method getY(): java.lang.Object
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC1 {
// source: 'inlineClassTypedEqualsGenerics.kt'
private final @org.jetbrains.annotations.NotNull field x: java.lang.Number
private synthetic method <init>(p0: java.lang.Number): void
public synthetic final static method box-impl(p0: java.lang.Number): IC1
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.Number): java.lang.Number
public method equals(p0: java.lang.Object): boolean
public final static method equals-P1kVloU(p0: java.lang.Number, @org.jetbrains.annotations.NotNull p1: java.lang.Number): boolean
public final static method equals-impl(p0: java.lang.Number, p1: int): boolean
public static method equals-impl(p0: java.lang.Number, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: java.lang.Number, p1: java.lang.Number): boolean
public final @org.jetbrains.annotations.NotNull method getX(): java.lang.Number
public method hashCode(): int
public static method hashCode-impl(p0: java.lang.Number): int
public method toString(): java.lang.String
public static method toString-impl(p0: java.lang.Number): java.lang.String
public synthetic final method unbox-impl(): java.lang.Number
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC2 {
// source: 'inlineClassTypedEqualsGenerics.kt'
private final @org.jetbrains.annotations.NotNull field value: Generic
private synthetic method <init>(p0: Generic): void
public synthetic final static method box-impl(p0: Generic): IC2
public static @org.jetbrains.annotations.NotNull method constructor-impl(@org.jetbrains.annotations.NotNull p0: Generic): Generic
public method equals(p0: java.lang.Object): boolean
public final static method equals-ACFGG4I(p0: Generic, @org.jetbrains.annotations.NotNull p1: Generic): boolean
public final static method equals-P1kVloU(p0: Generic, @org.jetbrains.annotations.NotNull p1: java.lang.Number): boolean
public static method equals-impl(p0: Generic, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: Generic, p1: Generic): boolean
public final @org.jetbrains.annotations.NotNull method getValue(): Generic
public method hashCode(): int
public static method hashCode-impl(p0: Generic): int
public method toString(): java.lang.String
public static method toString-impl(p0: Generic): java.lang.String
public synthetic final method unbox-impl(): Generic
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC3 {
// source: 'inlineClassTypedEqualsGenerics.kt'
private final field value: java.lang.Object
private synthetic method <init>(p0: java.lang.Object): void
public synthetic final static method box-impl(p0: java.lang.Object): IC3
public static @org.jetbrains.annotations.NotNull method constructor-impl(p0: java.lang.Object): java.lang.Object
public method equals(p0: java.lang.Object): boolean
public final static method equals-L6TIGmY(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.lang.Object): boolean
public final static method equals-impl(p0: java.lang.Object, p1: int): boolean
public static method equals-impl(p0: java.lang.Object, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: java.lang.Object, p1: java.lang.Object): boolean
public final method getValue(): java.lang.Object
public method hashCode(): int
public static method hashCode-impl(p0: java.lang.Object): int
public method toString(): java.lang.String
public static method toString-impl(p0: java.lang.Object): java.lang.String
public synthetic final method unbox-impl(): java.lang.Object
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC4 {
// source: 'inlineClassTypedEqualsGenerics.kt'
private final field value: java.lang.Object
private synthetic method <init>(p0: java.lang.Object): void
public synthetic final static method box-impl(p0: java.lang.Object): IC4
public static @org.jetbrains.annotations.NotNull method constructor-impl(p0: java.lang.Object): java.lang.Object
public method equals(p0: java.lang.Object): boolean
public final static method equals-hxZMMoI(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.lang.Object): boolean
public final static method equals-impl(p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: java.lang.String): boolean
public static method equals-impl(p0: java.lang.Object, p1: java.lang.Object): boolean
public final static method equals-impl0(p0: java.lang.Object, p1: java.lang.Object): boolean
public final method getValue(): java.lang.Object
public method hashCode(): int
public static method hashCode-impl(p0: java.lang.Object): int
public method toString(): java.lang.String
public static method toString-impl(p0: java.lang.Object): java.lang.String
public synthetic final method unbox-impl(): java.lang.Object
}
@kotlin.Metadata
public final class InlineClassTypedEqualsGenericsKt {
// source: 'inlineClassTypedEqualsGenerics.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,7 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import kotlin.math.abs
@@ -24,4 +27,4 @@ fun box(): String {
if (IC(1) != IC(2)) return "Fail 3"
if (IC(1) == IC(5)) return "Fail 4"
return "OK"
}
}
@@ -0,0 +1,24 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class IC {
// source: 'inlineClassUntypedEqualsOverriden.kt'
private final field x: int
private synthetic method <init>(p0: int): void
public synthetic final static method box-impl(p0: int): IC
public static method constructor-impl(p0: int): int
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean
public final method getX(): int
public method hashCode(): int
public static method hashCode-impl(p0: int): int
public method toString(): java.lang.String
public static method toString-impl(p0: int): java.lang.String
public synthetic final method unbox-impl(): int
}
@kotlin.Metadata
public final class InlineClassUntypedEqualsOverridenKt {
// source: 'inlineClassUntypedEqualsOverriden.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,6 +1,6 @@
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
+1 -1
View File
@@ -1,6 +1,6 @@
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
OPTIONAL_JVM_INLINE_ANNOTATION
+1 -1
View File
@@ -1,6 +1,6 @@
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
class A(x: Int)
@@ -0,0 +1,53 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
var counter = 0
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC(val x: Int, val y: Int) {
fun equals(other: MFVC): Boolean {
counter++
return x == other.x && this.y == other.y
}
override fun equals(other: Any?): Boolean {
counter++
if (other !is MFVC) {
return false
}
return equals(other)
}
override fun hashCode(): Int {
counter++
return x + 13 * y
}
}
fun box(): String {
val mfvc1 = MFVC(1, 2)
val mfvc2 = MFVC(3, 4)
require(mfvc1.equals(mfvc1))
require(!mfvc1.equals(mfvc2))
require(!mfvc2.equals(mfvc1))
require(mfvc2.equals(mfvc2))
require(mfvc1.equals(mfvc1 as Any?))
require(!mfvc1.equals(mfvc2 as Any?))
require(!mfvc2.equals(mfvc1 as Any?))
require(mfvc2.equals(mfvc2 as Any?))
require(mfvc1.hashCode() == 27)
require(mfvc2.hashCode() == 55)
require(counter == 4 + 2 * 4 + 2)
return "OK"
}
@@ -0,0 +1,29 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC {
// source: 'mfvcBothEqualsOverride.kt'
private final field field-0: int
private final field field-1: int
private synthetic method <init>(p0: int, p1: int): void
public synthetic final static method box-impl(p0: int, p1: int): MFVC
public final static method constructor-impl(p0: int, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: int, @org.jetbrains.annotations.Nullable p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: int, p1: int, p2: int, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: int, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: int, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): int
public synthetic final method unbox-impl-1(): int
}
@kotlin.Metadata
public final class MfvcBothEqualsOverrideKt {
// source: 'mfvcBothEqualsOverride.kt'
private static field counter: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getCounter(): int
public final static method setCounter(p0: int): void
}
@@ -0,0 +1,65 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import java.lang.AssertionError
import kotlin.math.abs
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC1(val x: Int, val y: Int) {
fun equals(other: MFVC1): Boolean {
return abs(x - other.x) < 2 && abs(y - other.y) < 2
}
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC2(val x: Int, val y: Int) {
override fun equals(other: Any?): Boolean {
if (other !is MFVC2) {
return false
}
return abs(x - other.x) < 2 && abs(y - other.y) < 2
}
}
fun box(): String {
val a1Typed: MFVC1 = MFVC1(1, 2)
val b1Typed: MFVC1 = MFVC1(2, 3)
val c1Typed: MFVC1 = MFVC1(3, 4)
val a1Untyped: Any = a1Typed
val b1Untyped: Any = b1Typed
val c1Untyped: Any = c1Typed
val a2Typed: MFVC2 = MFVC2(1, 2)
val b2Typed: MFVC2 = MFVC2(2, 3)
val c2Typed: MFVC2 = MFVC2(3, 4)
val a2Untyped: Any = a2Typed
val b2Untyped: Any = b2Typed
val c2Untyped: Any = c2Typed
require(a1Typed == a1Typed && a1Untyped == a1Untyped)
require(a1Typed == b1Typed && a1Untyped == b1Untyped)
require(a1Typed != c1Typed && a1Untyped != c1Untyped)
require(b1Typed == a1Typed && b1Untyped == a1Untyped)
require(b1Typed == b1Typed && b1Untyped == b1Untyped)
require(b1Typed == c1Typed && b1Untyped == c1Untyped)
require(c1Typed != a1Typed && c1Untyped != a1Untyped)
require(c1Typed == b1Typed && c1Untyped == b1Untyped)
require(c1Typed == c1Typed && c1Untyped == c1Untyped)
require(a2Typed == a2Typed && a2Untyped == a2Untyped)
require(a2Typed == b2Typed && a2Untyped == b2Untyped)
require(a2Typed != c2Typed && a2Untyped != c2Untyped)
require(b2Typed == a2Typed && b2Untyped == a2Untyped)
require(b2Typed == b2Typed && b2Untyped == b2Untyped)
require(b2Typed == c2Typed && b2Untyped == c2Untyped)
require(c2Typed != a2Typed && c2Untyped != a2Untyped)
require(c2Typed == b2Typed && c2Untyped == b2Untyped)
require(c2Typed == c2Typed && c2Untyped == c2Untyped)
return "OK"
}
@@ -0,0 +1,45 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC1 {
// source: 'mfvcEqualsConsistency.kt'
private final field field-0: int
private final field field-1: int
private synthetic method <init>(p0: int, p1: int): void
public synthetic final static method box-impl(p0: int, p1: int): MFVC1
public final static method constructor-impl(p0: int, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: int, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: int, p1: int, p2: int, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: int, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: int, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): int
public synthetic final method unbox-impl-1(): int
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC2 {
// source: 'mfvcEqualsConsistency.kt'
private final field field-0: int
private final field field-1: int
private synthetic method <init>(p0: int, p1: int): void
public synthetic final static method box-impl(p0: int, p1: int): MFVC2
public final static method constructor-impl(p0: int, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: int, @org.jetbrains.annotations.Nullable p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: int, p1: int, p2: int, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: int, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: int, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): int
public synthetic final method unbox-impl-1(): int
}
@kotlin.Metadata
public final class MfvcEqualsConsistencyKt {
// source: 'mfvcEqualsConsistency.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,25 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import kotlin.math.abs
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC(val x: Double, val y: Int) {
fun equals(other: MFVC): Boolean {
return abs(x - other.x) < 0.1
}
override fun hashCode(): Int {
return 0
}
}
fun box(): String {
val set = setOf(MFVC(1.0, 100), MFVC(1.5, 200), MFVC(1.501, 300))
return if (set.size == 2) "OK" else "Fail"
}
@@ -0,0 +1,25 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC {
// source: 'mfvcEqualsOverriddenForCollections.kt'
private final field field-0: double
private final field field-1: int
private synthetic method <init>(p0: double, p1: int): void
public synthetic final static method box-impl(p0: double, p1: int): MFVC
public final static method constructor-impl(p0: double, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: double, p1: int, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: double, p1: int, p2: double, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: double, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: double, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): double
public synthetic final method unbox-impl-1(): int
}
@kotlin.Metadata
public final class MfvcEqualsOverriddenForCollectionsKt {
// source: 'mfvcEqualsOverriddenForCollections.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,41 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import kotlin.math.abs
interface I {
fun equals(param: MFVC): Boolean
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC(val value: Int, val y: Int) : I {
override fun equals(param: MFVC): Boolean {
return abs(value - param.value) < 2
}
}
fun box(): String {
val a1Typed: MFVC = MFVC(1, 2)
val b1Typed: MFVC = MFVC(2, 3)
val c1Typed: MFVC = MFVC(3, 4)
val a1Untyped: I = a1Typed
val b1Untyped: I = b1Typed
val c1Untyped: I = c1Typed
require(a1Typed == a1Typed && a1Untyped == a1Untyped)
require(a1Typed == b1Typed && a1Untyped == b1Untyped)
require(a1Typed != c1Typed && a1Untyped != c1Untyped)
require(b1Typed == a1Typed && b1Untyped == a1Untyped)
require(b1Typed == b1Typed && b1Untyped == b1Untyped)
require(b1Typed == c1Typed && b1Untyped == c1Untyped)
require(c1Typed != a1Typed && c1Untyped != a1Untyped)
require(c1Typed == b1Typed && c1Untyped == b1Untyped)
require(c1Typed == c1Typed && c1Untyped == c1Untyped)
return "OK"
}
@@ -0,0 +1,32 @@
@kotlin.Metadata
public interface I {
// source: 'mfvcEqualsOverride.kt'
public abstract method equals-sUp7gFk(p0: int, p1: int): boolean
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC {
// source: 'mfvcEqualsOverride.kt'
private final field field-0: int
private final field field-1: int
private synthetic method <init>(p0: int, p1: int): void
public synthetic final static method box-impl(p0: int, p1: int): MFVC
public final static method constructor-impl(p0: int, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: int, p2: java.lang.Object): boolean
public method equals-sUp7gFk(p0: int, p1: int): boolean
public static method equals-sUp7gFk(p0: int, p1: int, p2: int, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: int, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: int, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): int
public synthetic final method unbox-impl-1(): int
}
@kotlin.Metadata
public final class MfvcEqualsOverrideKt {
// source: 'mfvcEqualsOverride.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,18 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
OPTIONAL_JVM_INLINE_ANNOTATION
value class A(val value1: MyClass, val value2: MyClass) {
override fun hashCode() = 42
}
class MyClass() {
override fun hashCode() = -1
}
fun box(): String = if (A(MyClass(), MyClass()).hashCode() == 42) "OK" else "Fail"
@@ -0,0 +1,32 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class A {
// source: 'mfvcHashCodeOverride.kt'
private final @org.jetbrains.annotations.NotNull field field-0: MyClass
private final @org.jetbrains.annotations.NotNull field field-1: MyClass
private synthetic method <init>(p0: MyClass, p1: MyClass): void
public synthetic final static method box-impl(p0: MyClass, p1: MyClass): A
public final static method constructor-impl(@org.jetbrains.annotations.NotNull p0: MyClass, @org.jetbrains.annotations.NotNull p1: MyClass): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: MyClass, p1: MyClass, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: MyClass, p1: MyClass, p2: MyClass, p3: MyClass): boolean
public method hashCode(): int
public static method hashCode-impl(@org.jetbrains.annotations.NotNull p0: MyClass, @org.jetbrains.annotations.NotNull p1: MyClass): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: MyClass, p1: MyClass): java.lang.String
public synthetic final method unbox-impl-0(): MyClass
public synthetic final method unbox-impl-1(): MyClass
}
@kotlin.Metadata
public final class MfvcHashCodeOverrideKt {
// source: 'mfvcHashCodeOverride.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@kotlin.Metadata
public final class MyClass {
// source: 'mfvcHashCodeOverride.kt'
public method <init>(): void
public method hashCode(): int
}
@@ -0,0 +1,56 @@
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC1<T : Number>(val x: T, val other: Int) {
fun equals(x: Int, other: Int) = false
fun equals(other: MFVC1<*>) = true
}
class Generic<T, R>(val x: T, val y: R)
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC2<T, R>(val value: Generic<T, R>, val other: Int) {
fun equals(value: MFVC1<Double>, other: Int) = false
fun equals(other: MFVC2<*, *>) = true
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC3<T>(val value: T, val other: Int) {
fun equals(value: Int, other: Int) = false
fun equals(other: MFVC3<*>) = true
}
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC4<T>(val value: T, val other: Int) {
fun equals(value: Any, other: Int) = false
fun equals(other: MFVC4<*>) = true
}
fun box() = when {
MFVC1(5.0, 100) != MFVC1(3, 100) -> "Fail 1.1"
(MFVC1(5.0, 100) as Any) != MFVC1(3, 100) -> "Fail 1.2"
MFVC1(5.0, 100) != (MFVC1(3, 100) as Any) -> "Fail 1.3"
(MFVC1(5.0, 100) as Any) != (MFVC1(3, 100) as Any) -> "Fail 1.4"
MFVC2(Generic("aba", 5.0), 100) != MFVC2(Generic(3, 8), 100) -> "Fail 2.1"
(MFVC2(Generic("aba", 5.0), 100) as Any) != MFVC2(Generic(3, 8), 100) -> "Fail 2.2"
MFVC2(Generic("aba", 5.0), 100) != (MFVC2(Generic(3, 8), 100) as Any) -> "Fail 2.3"
(MFVC2(Generic("aba", 5.0), 100) as Any) != (MFVC2(Generic(3, 8), 100) as Any) -> "Fail 2.4"
MFVC3("x", 100) != MFVC3("y", 100) -> "Fail 3.1"
(MFVC3("x", 100) as Any) != MFVC3("y", 100) -> "Fail 3.2"
MFVC3("x", 100) != (MFVC3("y", 100) as Any) -> "Fail 3.3"
(MFVC3("x", 100) as Any) != (MFVC3("y", 100) as Any) -> "Fail 3.4"
MFVC4("aba", 100) != MFVC4("caba", 100) -> "Fail 4.1"
(MFVC4("aba", 100) as Any) != MFVC4("caba", 100) -> "Fail 4.2"
MFVC4("aba", 100) != (MFVC4("caba", 100) as Any) -> "Fail 4.3"
(MFVC4("aba", 100) as Any) != (MFVC4("caba", 100) as Any) -> "Fail 4.4"
else -> "OK"
}
@@ -0,0 +1,99 @@
@kotlin.Metadata
public final class Generic {
// source: 'mfvcTypedEqualsGenerics.kt'
private final field x: java.lang.Object
private final field y: java.lang.Object
public method <init>(p0: java.lang.Object, p1: java.lang.Object): void
public final method getX(): java.lang.Object
public final method getY(): java.lang.Object
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC1 {
// source: 'mfvcTypedEqualsGenerics.kt'
private final @org.jetbrains.annotations.NotNull field field-0: java.lang.Number
private final field field-1: int
private synthetic method <init>(p0: java.lang.Number, p1: int): void
public synthetic final static method box-impl(p0: java.lang.Number, p1: int): MFVC1
public final static method constructor-impl(@org.jetbrains.annotations.NotNull p0: java.lang.Number, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final static method equals-impl(@org.jetbrains.annotations.NotNull p0: java.lang.Number, p1: int, p2: int, p3: int): boolean
public static method equals-impl(p0: java.lang.Number, p1: int, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(@org.jetbrains.annotations.NotNull p0: java.lang.Number, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.Number, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: java.lang.Number, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: java.lang.Number, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): java.lang.Number
public synthetic final method unbox-impl-1(): int
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC2 {
// source: 'mfvcTypedEqualsGenerics.kt'
private final @org.jetbrains.annotations.NotNull field field-0: Generic
private final field field-1: int
private synthetic method <init>(p0: Generic, p1: int): void
public synthetic final static method box-impl(p0: Generic, p1: int): MFVC2
public final static method constructor-impl(@org.jetbrains.annotations.NotNull p0: Generic, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final static method equals-GPBa7dw(@org.jetbrains.annotations.NotNull p0: Generic, p1: int, p2: double, p3: int, p4: int): boolean
public static method equals-impl(p0: Generic, p1: int, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(@org.jetbrains.annotations.NotNull p0: Generic, p1: int, @org.jetbrains.annotations.NotNull p2: Generic, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: Generic, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: Generic, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): Generic
public synthetic final method unbox-impl-1(): int
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC3 {
// source: 'mfvcTypedEqualsGenerics.kt'
private final field field-0: java.lang.Object
private final field field-1: int
private synthetic method <init>(p0: java.lang.Object, p1: int): void
public synthetic final static method box-impl(p0: java.lang.Object, p1: int): MFVC3
public final static method constructor-impl(p0: java.lang.Object, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final static method equals-impl(p0: java.lang.Object, p1: int, p2: int, p3: int): boolean
public static method equals-impl(p0: java.lang.Object, p1: int, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: java.lang.Object, p1: int, p2: java.lang.Object, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: java.lang.Object, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: java.lang.Object, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): java.lang.Object
public synthetic final method unbox-impl-1(): int
}
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC4 {
// source: 'mfvcTypedEqualsGenerics.kt'
private final field field-0: java.lang.Object
private final field field-1: int
private synthetic method <init>(p0: java.lang.Object, p1: int): void
public synthetic final static method box-impl(p0: java.lang.Object, p1: int): MFVC4
public final static method constructor-impl(p0: java.lang.Object, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public final static method equals-impl(p0: java.lang.Object, p1: int, @org.jetbrains.annotations.NotNull p2: java.lang.Object, p3: int): boolean
public static method equals-impl(p0: java.lang.Object, p1: int, p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: java.lang.Object, p1: int, p2: java.lang.Object, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: java.lang.Object, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: java.lang.Object, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): java.lang.Object
public synthetic final method unbox-impl-1(): int
}
@kotlin.Metadata
public final class MfvcTypedEqualsGenericsKt {
// source: 'mfvcTypedEqualsGenerics.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,26 @@
// IGNORE_BACKEND_FIR: JVM_IR
// https://youtrack.jetbrains.com/issue/KT-52236/Different-modality-in-psi-and-fir
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
// LANGUAGE: +ValueClasses, +CustomEqualsInValueClasses
// TARGET_BACKEND: JVM_IR
// CHECK_BYTECODE_LISTING
import kotlin.math.abs
OPTIONAL_JVM_INLINE_ANNOTATION
value class MFVC(val x: Int, val y: Int) {
override fun equals(other: Any?): Boolean {
if (other !is MFVC) {
return false
}
return abs(x - other.x) < 2 && abs(y - other.y) < 2
}
override fun hashCode() = 0
}
fun box(): String {
val set = setOf(MFVC(1, 2), MFVC(2, 3), MFVC(5, 6))
return if (set.size == 2) "OK" else "Fail"
}
@@ -0,0 +1,25 @@
@kotlin.jvm.JvmInline
@kotlin.Metadata
public final class MFVC {
// source: 'mfvcUntypedEqualsOverriden.kt'
private final field field-0: int
private final field field-1: int
private synthetic method <init>(p0: int, p1: int): void
public synthetic final static method box-impl(p0: int, p1: int): MFVC
public final static method constructor-impl(p0: int, p1: int): void
public method equals(@org.jetbrains.annotations.Nullable p0: java.lang.Object): boolean
public static method equals-impl(p0: int, p1: int, @org.jetbrains.annotations.Nullable p2: java.lang.Object): boolean
public final static method equals-sUp7gFk(p0: int, p1: int, p2: int, p3: int): boolean
public method hashCode(): int
public static method hashCode-impl(p0: int, p1: int): int
public @org.jetbrains.annotations.NotNull method toString(): java.lang.String
public static method toString-impl(p0: int, p1: int): java.lang.String
public synthetic final method unbox-impl-0(): int
public synthetic final method unbox-impl-1(): int
}
@kotlin.Metadata
public final class MfvcUntypedEqualsOverridenKt {
// source: 'mfvcUntypedEqualsOverriden.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -1,11 +1,11 @@
// FIR_IDENTICAL
// WITH_STDLIB
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
// LANGUAGE: +CustomEqualsInInlineClasses
// LANGUAGE: +CustomEqualsInValueClasses
@JvmInline
value class IC1(val x: Int) {
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_INLINE_CLASS!>equals<!>(other: Any?): Boolean {
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_VALUE_CLASS!>equals<!>(other: Any?): Boolean {
if (other !is IC1) {
return false
}
@@ -29,9 +29,9 @@ value class IC3(val x: Int) {
@JvmInline
value class IC4<T>(val x: Int) {
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_INLINE_CLASS!>equals<!>(other: Any?) = true
override fun equals(other: Any?) = true
fun equals(other: IC4<T>) = true
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC4<T><!>) = true
override fun hashCode() = 0
}
}
@@ -1,18 +1,21 @@
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses, +CustomEqualsInInlineClasses
// WITH_STDLIB
// !LANGUAGE: +CustomEqualsInValueClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
inline class IC1(val x: Any) {
@JvmInline
value class IC1(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>() {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>() {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_INLINE_CLASS!>equals<!>(other: Any?): Boolean = true
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_VALUE_CLASS!>equals<!>(other: Any?): Boolean = true
override fun hashCode(): Int = 0
}
inline class IC2(val x: Any) {
@JvmInline
value class IC2(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): Any = TODO()
@@ -23,7 +26,8 @@ inline class IC2(val x: Any) {
fun hashCode(a: Any): Int = 0
}
inline class IC3(val x: Any) {
@JvmInline
value class IC3(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any): Any = TODO()
@@ -34,12 +38,34 @@ interface WithBox {
fun box(): String
}
inline class IC4(val s: String) : WithBox {
@JvmInline
value class IC4(val s: String) : WithBox {
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): String = ""
}
inline class IC5(val a: String) {
@JvmInline
value class IC5(val a: String) {
constructor(i: Int) : this(i.toString()) <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{<!>
TODO("something")
}
}
}
@JvmInline
value class IC6(val a: String) {
fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> equals(other: IC6): Boolean = true
}
@JvmInline
value class IC7<T>(val a: String) {
fun equals(other: IC7<*>): Boolean = true
}
@JvmInline
value class IC8<T>(val a: String) {
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC8<T><!>): Boolean = true
}
@JvmInline
value class IC9<T>(val a: String) {
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC9<String><!>): Boolean = true
}
@@ -1,6 +1,6 @@
package
public final inline class IC1 {
@kotlin.jvm.JvmInline public final value class IC1 {
public constructor IC1(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Unit
@@ -12,7 +12,7 @@ public final inline class IC1 {
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
public final inline class IC2 {
@kotlin.jvm.JvmInline public final value class IC2 {
public constructor IC2(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Any
@@ -26,7 +26,7 @@ public final inline class IC2 {
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
public final inline class IC3 {
@kotlin.jvm.JvmInline public final value class IC3 {
public constructor IC3(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Any
@@ -37,7 +37,7 @@ public final inline class IC3 {
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any
}
public final inline class IC4 : WithBox {
@kotlin.jvm.JvmInline public final value class IC4 : WithBox {
public constructor IC4(/*0*/ s: kotlin.String)
public final val s: kotlin.String
public open override /*1*/ fun box(): kotlin.String
@@ -46,7 +46,7 @@ public final inline class IC4 : WithBox {
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final inline class IC5 {
@kotlin.jvm.JvmInline public final value class IC5 {
public constructor IC5(/*0*/ i: kotlin.Int)
public constructor IC5(/*0*/ a: kotlin.String)
public final val a: kotlin.String
@@ -55,9 +55,46 @@ public final inline class IC5 {
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmInline public final value class IC6 {
public constructor IC6(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public final fun </*0*/ T> equals(/*0*/ other: IC6): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class IC7</*0*/ T> {
public constructor IC7</*0*/ T>(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public final fun equals(/*0*/ other: IC7<*>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class IC8</*0*/ T> {
public constructor IC8</*0*/ T>(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public final fun equals(/*0*/ other: IC8<T>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class IC9</*0*/ T> {
public constructor IC9</*0*/ T>(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public final fun equals(/*0*/ other: IC9<kotlin.String>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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 interface WithBox {
public abstract fun box(): kotlin.String
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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,7 +1,7 @@
// FIR_IDENTICAL
// WITH_STDLIB
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
// LANGUAGE: +CustomEqualsInInlineClasses
// LANGUAGE: +CustomEqualsInValueClasses
@JvmInline
@@ -23,12 +23,12 @@ value class IC2(val x: Int) {
@JvmInline
value class IC3<T>(val x: T) {
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: IC3<T>) = true
operator fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC3<T><!>) = true
}
@JvmInline
value class IC4<T>(val x: T) {
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: IC4<String>) = true
operator fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>IC4<String><!>) = true
}
@JvmInline
@@ -49,4 +49,4 @@ value class IC7<T, R>(val x: T) {
@JvmInline
value class IC8<T, R>(val x: T) {
operator fun equals(other: IC8<*, *>): Nothing = TODO()
}
}
@@ -0,0 +1,23 @@
// FIR_IDENTICAL
// WITH_STDLIB
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
// LANGUAGE: +CustomEqualsInValueClasses
// SKIP_TXT
@JvmInline
value class IC1(val x: Int) {
override fun equals(other: Any?) = true
operator fun equals(other: IC1) = true
override fun hashCode() = 0
}
@JvmInline
value class IC2(val x: Int) {
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: IC1) = true
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: IC2) {
}
}
@@ -0,0 +1,28 @@
// FIR_IDENTICAL
// WITH_STDLIB
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
// LANGUAGE: +CustomEqualsInValueClasses +ValueClasses
@JvmInline
value class MFVC1(val x: Int, val y: Int) {
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_VALUE_CLASS!>equals<!>(other: Any?): Boolean {
if (other !is MFVC1) {
return false
}
return x == other.x
}
}
@JvmInline
value class MFVC2(val x: Int, val y: Int) {
override fun hashCode() = 0
}
@JvmInline
value class MFVC3(val x: Int, val y: Int) {
override fun equals(other: Any?) = true
fun equals(other: MFVC3) = true
override fun hashCode() = 0
}
@@ -0,0 +1,29 @@
package
@kotlin.jvm.JvmInline public final value class MFVC1 {
public constructor MFVC1(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val x: kotlin.Int
public final val y: kotlin.Int
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
}
@kotlin.jvm.JvmInline public final value class MFVC2 {
public constructor MFVC2(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val x: kotlin.Int
public final val y: kotlin.Int
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class MFVC3 {
public constructor MFVC3(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val x: kotlin.Int
public final val y: kotlin.Int
public final fun equals(/*0*/ other: MFVC3): kotlin.Boolean
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
}
@@ -1,5 +1,5 @@
// !SKIP_JAVAC
// !LANGUAGE: +CustomEqualsInInlineClasses, +ValueClasses
// !LANGUAGE: +CustomEqualsInValueClasses, +ValueClasses
// ALLOW_KOTLIN_PACKAGE
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -102,4 +102,24 @@ value class MFVC5(val a: String, val b: String) {
constructor(i: Int) : this(i.toString(), "6") <!SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS!>{<!>
TODO("something")
}
}
}
@JvmInline
value class MFVC6(val a: String, val b: String) {
fun <!TYPE_PARAMETERS_NOT_ALLOWED!><T><!> equals(other: MFVC6): Boolean = true
}
@JvmInline
value class MFVC7<T>(val a: String, val b: String) {
fun equals(other: MFVC7<*>): Boolean = true
}
@JvmInline
value class MFVC8<T>(val a: String, val b: String) {
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>MFVC8<T><!>): Boolean = true
}
@JvmInline
value class MFVC9<T>(val a: String, val b: String) {
fun equals(other: <!TYPE_ARGUMENT_ON_TYPED_VALUE_CLASS_EQUALS!>MFVC9<String><!>): Boolean = true
}
@@ -0,0 +1,186 @@
package
package kotlin {
package kotlin.jvm {
@kotlin.jvm.JvmInline public final value class IC1 {
public constructor IC1(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Unit
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
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 final fun unbox(): kotlin.Unit
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.jvm.JvmInline public final value class IC2 {
public constructor IC2(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Any
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.jvm.JvmInline public final value class IC3 {
public constructor IC3(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Any
public final fun equals(): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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 final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any
}
@kotlin.jvm.JvmInline public final value class IC4 : kotlin.jvm.WithBox {
public constructor IC4(/*0*/ s: kotlin.String)
public final val s: kotlin.String
public open override /*1*/ fun box(): kotlin.String
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class IC5 {
public constructor IC5(/*0*/ i: kotlin.Int)
public constructor IC5(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class IC6 {
public constructor IC6(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun </*0*/ T> equals(/*0*/ other: kotlin.jvm.IC6): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmInline public final value class MFVC1 {
public constructor MFVC1(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any)
public final val x: kotlin.Any
public final val y: kotlin.Any
public final fun box(): kotlin.Unit
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
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 final fun unbox(): kotlin.Unit
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.jvm.JvmInline public final value class MFVC2 {
public constructor MFVC2(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any)
public final val x: kotlin.Any
public final val y: kotlin.Any
public final fun box(): kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Any
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.jvm.JvmInline public final value class MFVC3 {
public constructor MFVC3(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any)
public final val x: kotlin.Any
public final val y: kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Any
public final fun equals(): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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 final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any
}
@kotlin.jvm.JvmInline public final value class MFVC4 : kotlin.jvm.WithBox {
public constructor MFVC4(/*0*/ s: kotlin.String, /*1*/ t: kotlin.String)
public final val s: kotlin.String
public final val t: kotlin.String
public open override /*1*/ fun box(): kotlin.String
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class MFVC5 {
public constructor MFVC5(/*0*/ i: kotlin.Int)
public constructor MFVC5(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String)
public final val a: kotlin.String
public final val b: kotlin.String
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class MFVC6 {
public constructor MFVC6(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String)
public final val a: kotlin.String
public final val b: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun </*0*/ T> equals(/*0*/ other: kotlin.jvm.MFVC6): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmInline public final value class MFVC7</*0*/ T> {
public constructor MFVC7</*0*/ T>(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String)
public final val a: kotlin.String
public final val b: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun equals(/*0*/ other: kotlin.jvm.MFVC7<*>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmInline public final value class MFVC8</*0*/ T> {
public constructor MFVC8</*0*/ T>(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String)
public final val a: kotlin.String
public final val b: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun equals(/*0*/ other: kotlin.jvm.MFVC8<T>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@kotlin.jvm.JvmInline public final value class MFVC9</*0*/ T> {
public constructor MFVC9</*0*/ T>(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String)
public final val a: kotlin.String
public final val b: kotlin.String
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun equals(/*0*/ other: kotlin.jvm.MFVC9<kotlin.String>): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
public interface WithBox {
public abstract fun box(): kotlin.String
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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
}
@@ -1,57 +0,0 @@
// FIR_IDENTICAL
// !SKIP_JAVAC
// !LANGUAGE: +InlineClasses, +CustomEqualsInInlineClasses
// ALLOW_KOTLIN_PACKAGE
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kotlin.jvm
annotation class JvmInline
@JvmInline
value class IC1(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>() {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>() {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
override fun <!INEFFICIENT_EQUALS_OVERRIDING_IN_INLINE_CLASS!>equals<!>(other: Any?): Boolean = true
override fun hashCode(): Int = 0
}
@JvmInline
value class IC2(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(): Any = TODO()
fun equals(my: Any, other: Any): Boolean = true
fun hashCode(a: Any): Int = 0
}
@JvmInline
value class IC3(val x: Any) {
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(x: Any): Any = TODO()
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any): Any = TODO()
fun equals(): Boolean = true
}
interface WithBox {
fun box(): String
}
@JvmInline
value class IC4(val s: String) : WithBox {
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>box<!>(): String = ""
}
@JvmInline
value class IC5(val a: String) {
constructor(i: Int) : this(i.toString()) {
TODO("something")
}
}
@@ -1,76 +0,0 @@
package
package kotlin {
package kotlin.jvm {
@kotlin.jvm.JvmInline public final value class IC1 {
public constructor IC1(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Unit
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
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 final fun unbox(): kotlin.Unit
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.jvm.JvmInline public final value class IC2 {
public constructor IC2(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(): kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Unit
public final fun equals(/*0*/ my: kotlin.Any, /*1*/ other: kotlin.Any): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
public final fun hashCode(/*0*/ a: kotlin.Any): kotlin.Int
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
public final fun unbox(): kotlin.Any
public final fun unbox(/*0*/ x: kotlin.Any): kotlin.Unit
}
@kotlin.jvm.JvmInline public final value class IC3 {
public constructor IC3(/*0*/ x: kotlin.Any)
public final val x: kotlin.Any
public final fun box(/*0*/ x: kotlin.Any): kotlin.Any
public final fun equals(): kotlin.Boolean
public open override /*1*/ /*synthesized*/ 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 final fun unbox(/*0*/ x: kotlin.Any): kotlin.Any
}
@kotlin.jvm.JvmInline public final value class IC4 : kotlin.jvm.WithBox {
public constructor IC4(/*0*/ s: kotlin.String)
public final val s: kotlin.String
public open override /*1*/ fun box(): kotlin.String
public open override /*1*/ /*synthesized*/ 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
}
@kotlin.jvm.JvmInline public final value class IC5 {
public constructor IC5(/*0*/ i: kotlin.Int)
public constructor IC5(/*0*/ a: kotlin.String)
public final val a: kotlin.String
public open override /*1*/ /*synthesized*/ 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 final annotation class JvmInline : kotlin.Annotation {
public constructor JvmInline()
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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface WithBox {
public abstract fun box(): kotlin.String
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 override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
}
@@ -0,0 +1,22 @@
// FIR_IDENTICAL
// WITH_STDLIB
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
// LANGUAGE: +CustomEqualsInValueClasses, +ValueClasses
@JvmInline
value class MFVC1(val x: Int, val y: Int) {
override fun equals(other: Any?) = true
operator fun equals(other: MFVC1) = true
override fun hashCode() = 0
}
@JvmInline
value class MFVC2(val x: Int, val y: Int) {
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: MFVC1) = true
<!INAPPLICABLE_OPERATOR_MODIFIER!>operator<!> fun equals(other: MFVC2) {
}
}
@@ -0,0 +1,22 @@
package
@kotlin.jvm.JvmInline public final value class MFVC1 {
public constructor MFVC1(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val x: kotlin.Int
public final val y: kotlin.Int
public final operator fun equals(/*0*/ other: MFVC1): kotlin.Boolean
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
}
@kotlin.jvm.JvmInline public final value class MFVC2 {
public constructor MFVC2(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int)
public final val x: kotlin.Int
public final val y: kotlin.Int
public final operator fun equals(/*0*/ other: MFVC1): kotlin.Boolean
public final operator fun equals(/*0*/ other: MFVC2): kotlin.Unit
public open override /*1*/ /*synthesized*/ 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
}