357f3184bf
The `irGetField` utility uses the field's own type as the type of the resulting expression. But the field's type does not make sense outside of the place of declaration of the field if it references a generic type parameter of the containing class. Using this non-sensical generic type led, for example, to an error in Ieee754 intrinsic (KT-48648). The type of the expression should be kept as is in JvmPropertiesLowering, i.e. taken from `expression` which the lowering is replacing with the field access. #KT-48648 Fixed
23 lines
453 B
Kotlin
Vendored
23 lines
453 B
Kotlin
Vendored
// !LANGUAGE: -ProhibitJvmFieldOnOverrideFromInterfaceInPrimaryConstructor
|
|
// TARGET_BACKEND: JVM
|
|
// WITH_RUNTIME
|
|
|
|
interface A { val x: Int }
|
|
|
|
open class B(@JvmField override val x: Int): A
|
|
|
|
class BB(x: Int) : B(x)
|
|
|
|
class C<D: A>(@JvmField val d: D)
|
|
|
|
class E(c: C<BB>) { val ax = c.d.x }
|
|
// CHECK_BYTECODE_TEXT
|
|
// 1 GETFIELD BB\.x \: I
|
|
|
|
fun box(): String {
|
|
val e = E(C(BB(42)))
|
|
if (e.ax != 42)
|
|
return "Failed: ${e.ax}"
|
|
return "OK"
|
|
}
|