36b8ba8df3
- Ensure that typed equals parameter's type is a star projection of corresponding inline class - Make possible to declare typed equals that returns 'Nothing' - Forbid type parameters in typed equals operator declaration ^KT-54909 fixed ^KT-54910 fixed
18 lines
434 B
Kotlin
Vendored
18 lines
434 B
Kotlin
Vendored
// WITH_STDLIB
|
|
// WORKS_WHEN_VALUE_CLASS
|
|
// LANGUAGE: +ValueClasses, +CustomEqualsInInlineClasses
|
|
// TARGET_BACKEND: JVM_IR
|
|
|
|
OPTIONAL_JVM_INLINE_ANNOTATION
|
|
value class A(val x: Int) {
|
|
operator fun equals(other: A) = x % 5 == other.x % 5
|
|
}
|
|
|
|
OPTIONAL_JVM_INLINE_ANNOTATION
|
|
value class B(val x: A)
|
|
|
|
fun box() = if (B(A(0)) == B(A(5))) "OK" else "Fail"
|
|
|
|
// CHECK_BYTECODE_TEXT
|
|
// 0 INVOKESTATIC B.box-impl
|
|
// 0 INVOKESTATIC A.box-impl |