Sebastian Krajewski
04/19/2019, 6:57 PMCause: Label wasn't found during iterating through instructions
Element is unknownThe root cause was thrown at: LabelNormalizationMethodTransformer.kt:148Sebastian Krajewski
04/19/2019, 7:01 PMclass foo(var bar : String)
fun main() {
var baz : foo? = foo("test")
baz?.bar += "test"
}streetsofboston
04/19/2019, 7:03 PMnull property…?
baz?.bar could be null. Then you may wind up with null += test.
This should not compile. But instead of a compiler error you get a compiler crash…streetsofboston
04/19/2019, 7:06 PMSebastian Krajewski
04/19/2019, 7:07 PMstreetsofboston
04/19/2019, 7:08 PMbaz?.let { it.bar += test }streetsofboston
04/19/2019, 7:18 PMclass Container(
var value : String = ""
)
fun bug() {
val container : Container? = null
container?.value += "2"
}
It seems to come from the += operator with an optional/nullable left-hand side expressionSebastian Krajewski
04/19/2019, 7:19 PM?.plus() seems to workSebastian Krajewski
04/19/2019, 7:20 PMstreetsofboston
04/19/2019, 7:21 PMString is a immutable class, the += is not a plusAssign. It probably rewrites it a object = object + param, which may fail….streetsofboston
04/19/2019, 7:22 PMclass Container(
var value : String = ""
)
fun bug() {
val container : Container? = null
container?.value = container?.value + "2"
}
You should file a bug.Sebastian Krajewski
04/19/2019, 7:24 PMstreetsofboston
04/19/2019, 7:26 PMSebastian Krajewski
04/19/2019, 7:26 PM