Files
kotlin/compiler/testData/codegen/bytecodeText/accessorForOverridenVal.kt
Mads Ager d68a1898d0 JVM_IR: Use direct field access instead of calling certain accessors.
Final default properties accessors that access a backing field
on the same class can be replaced by direct field use.

Perform the optimization late in the pipeline to allow lowerings
to expose more opportunities for optimizations.
2020-01-31 09:31:52 +01:00

20 lines
433 B
Kotlin
Vendored

package b
abstract class B {
open val propWithFinal: Int
get() = 1
open val propWithNonFinal: Int
get() = 2
}
abstract class Base: B() {
override final val propWithFinal: Int = 3
override val propWithNonFinal: Int = 4
fun fooFinal() = this.propWithFinal
fun fooNonFinal() = this.propWithNonFinal
}
// 2 GETFIELD b/Base.propWithFinal : I
// 1 INVOKEVIRTUAL b/Base.getPropWithNonFinal \(\)I