e079fb665e
For subclasses of `AbstractMutableList<Int>` which are not inline classes, the special bridge `remove` had a parameter of type `Int` (mapped to JVM primitive int) before this fix. The hack in `MethodSignatureMapper` changed this type to `Int?`, yet the body of the special bridge still loaded it as non-nullable, which resulted in incorrect bytecode. It looks like a part of this hack in `BridgeLowering` was made only for inline classes which are subclasses of mutable collections. Supposedly it should be extended to non-inline classes, so that `remove` special bridge would have consistent IR by the time it reaches codegen. #KT-46516 Fixed
19 lines
488 B
Kotlin
Vendored
19 lines
488 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
// IGNORE_BACKEND: WASM
|
|
|
|
abstract class A : AbstractMutableList<Int>()
|
|
|
|
class B : A() {
|
|
override fun iterator(): MutableIterator<Int> = mutableListOf(0).iterator()
|
|
override val size = 0
|
|
override fun add(index: Int, element: Int) {}
|
|
override fun get(index: Int) = index
|
|
override fun removeAt(index: Int) = index
|
|
override fun set(index: Int, element: Int) = index
|
|
}
|
|
|
|
fun box(): String {
|
|
val b = B()
|
|
return if (b.remove(0)) "OK" else "Fail"
|
|
}
|