JVM_IR never generate setter synthetic accessor for 'val' field
KT-49316
This commit is contained in:
committed by
TeamCityServer
parent
d7ae7ca911
commit
4f0c3c3c0d
@@ -0,0 +1,27 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
// 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)
|
||||
@@ -0,0 +1,17 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// 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"
|
||||
}
|
||||
|
||||
// CHECK_BYTECODE_LISTING
|
||||
// - there should be no synthetic accessor generated in 'Foo'
|
||||
class Foo(val s: String)
|
||||
|
||||
fun box() = test(Foo("OK"))
|
||||
@@ -0,0 +1,14 @@
|
||||
@kotlin.Metadata
|
||||
public final class Foo {
|
||||
// source: 'kt49316a.kt'
|
||||
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Kt49316aKt {
|
||||
// source: 'kt49316a.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method test(@org.jetbrains.annotations.NotNull p0: Foo): java.lang.String
|
||||
}
|
||||
Reference in New Issue
Block a user