Files
kotlin-fork/compiler/testData/codegen/box/syntheticAccessors/kt49316.kt
T
Dmitriy Novozhilov 02e327277e [FIR] Report VAL_REASSIGNMENT on assign to non-local vals
In this commit reporting on member properties in init section of class
  is not supported (see KT-55528)

^KT-55493 Fixed
2022-12-20 08:12:09 +00:00

30 lines
963 B
Kotlin
Vendored

// IGNORE_BACKEND: JS, NATIVE
// IGNORE_BACKEND_K2: ANY
// FIR_STATUS: KT-35565
// java.lang.AssertionError
// at org.jetbrains.kotlin.js.translate.context.TranslationContext.getDispatchReceiver(TranslationContext.java:590)
// at org.jetbrains.kotlin.js.translate.utils.TranslationUtils.backingFieldReference(TranslationUtils.java:237)
// at org.jetbrains.kotlin.js.translate.utils.TranslationUtils.assignmentToBackingField(TranslationUtils.java:250)
// at org.jetbrains.kotlin.js.translate.reference.BackingFieldAccessTranslator.translateAsSet(BackingFieldAccessTranslator.java:60)
// ...
// FILE: kt49316.kt
import a.*
// This test should become irrelevant after KT-35565 is fixed.
fun test(foo: Foo): String {
return foo.s
// VAL_REASSIGNMENT not reported in unreachable code.
// Make sure there's no BE internal error here.
foo.s = "oops"
}
fun box() = test(Foo("OK"))
// FILE: Foo.kt
package a
class Foo(val s: String)