Support of custom 'equals' and 'hashCode' in inline classes
'equals' from any made available for overriding in inline classes 'typed' equals made available for definition in inline classes 'typed' equals definition made compulsory if 'untyped' is overridden 'operator' keyword is allowed in 'typed' equals definition ^KT-24874: Fixed
This commit is contained in:
committed by
teamcity
parent
527e8dde27
commit
e0c8142106
Vendored
+6
-6
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses
|
||||
// !LANGUAGE: +InlineClasses, -JvmInlineValueClasses, +CustomEqualsInInlineClasses
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
inline class IC1(val x: Any) {
|
||||
@@ -8,8 +8,8 @@ inline class IC1(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>() {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
|
||||
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>equals<!>(other: Any?): Boolean = true
|
||||
override fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>hashCode<!>(): Int = 0
|
||||
<!INEFFICIENT_EQUALS_OVERRIDING_IN_INLINE_CLASS!>override fun equals(other: Any?): Boolean<!> = true
|
||||
override fun hashCode(): Int = 0
|
||||
}
|
||||
|
||||
inline class IC2(val x: Any) {
|
||||
@@ -19,15 +19,15 @@ inline class IC2(val x: Any) {
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(x: Any) {}
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>unbox<!>(): Any = TODO()
|
||||
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>equals<!>(my: Any, other: Any): Boolean = true
|
||||
fun <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>hashCode<!>(a: Any): Int = 0
|
||||
fun equals(my: Any, other: Any): Boolean = true
|
||||
fun hashCode(a: Any): Int = 0
|
||||
}
|
||||
|
||||
inline 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 <!RESERVED_MEMBER_INSIDE_VALUE_CLASS!>equals<!>(): Boolean = true
|
||||
fun equals(): Boolean = true
|
||||
}
|
||||
|
||||
interface WithBox {
|
||||
|
||||
Reference in New Issue
Block a user