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
@@ -0,0 +1,14 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class A(val value: MyClass) {
|
||||
override fun hashCode() = 42
|
||||
}
|
||||
|
||||
class MyClass() {
|
||||
override fun hashCode() = -1
|
||||
}
|
||||
|
||||
fun box(): String = if (A(MyClass()).hashCode() == 42) "OK" else "Fail"
|
||||
Reference in New Issue
Block a user