[FIR] Skip expect-actual rules check when overriding non-expect member

Overriding equals, hashCode, toString and any other member that is not
expect does not require satisfying the rules of expect-actual matching.

#KT-57381 Fixed
This commit is contained in:
Kirill Rakhman
2023-03-28 14:47:38 +02:00
committed by Space Team
parent ef51cf9083
commit 32cc28c6cf
15 changed files with 106 additions and 0 deletions
@@ -0,0 +1,27 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: ANY
// IGNORE_BACKEND: WASM
// MODULE: common
// FILE: common.kt
open class Base {
open operator fun plus(b: Base) = Base()
}
expect open class Derived constructor() : Base() {
}
// MODULE: main()()(common)
// FILE: main.kt
actual open class Derived : Base() {
// Any.equals is is external on Native but because it's not expect, it's ok to override without external
override fun equals(other: Any?): Boolean = other === this
override fun hashCode() = 1
override fun toString() = "Derived"
// no operator modifier is legal because Base.plus is not expect
override fun plus(b: Base) = Derived()
}
fun box() = "OK"