[IR] Support user-defined equals for MFVC
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
51f9f31a0a
commit
9f01ccc304
Vendored
+5
-5
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+34
-8
@@ -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
|
||||
}
|
||||
|
||||
Vendored
+42
-5
@@ -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
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+23
@@ -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) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user