[JVM IR] Fix issue where fields are not being set to their default
values within initializer blocks.
The issue occurs in code like this:
```
class C {
var b = true
init {
b = false // Missing PUTFIELD for this statement
}
}
```
Added a new statement origin for field initialization (at declaration)
instead of relying on `origin == null` in ExpressionCodegen to determine
whether to generate the initializations.
This was unintentionally broken in
d68a1898d0.
This commit is contained in:
committed by
Dmitry Petrov
parent
56c819f06e
commit
64141b8b38
@@ -90,5 +90,8 @@ class NonRedundantInitializers {
|
||||
val myFloat: Float = -0.0f
|
||||
}
|
||||
|
||||
// There is 1 PUTSTATIC for the companion object instance.
|
||||
|
||||
// 0 PUTFIELD RedundantInitializersToDefault
|
||||
// 2 PUTFIELD NonRedundantInitializers
|
||||
// 1 PUTSTATIC
|
||||
|
||||
Reference in New Issue
Block a user