Revert "JVM: remove support for disabling NoConstantValueAttributeForNonConstVals"
This is a partial revert of e857966edb.
Specifically, behavior is restored in the old backend, which will allow
to support language version 1.3, where this language feature was not
enabled yet. There are no changes in the JVM IR backend, because to
enable JVM IR with LV 1.3, you need to pass the compiler argument
`-Xuse-ir` which is not stable and we don't guarantee anything about it.
#KT-50251
This commit is contained in:
+2
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +NoConstantValueAttributeForNonConstVals +JvmFieldInInterface
|
||||
|
||||
class C {
|
||||
val testClassVal = 100
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// ^ Disables a language feature introduced in 1.4. This test checks old backend's behavior and is needed as long as we support language version 1.3.
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FIR status: don't support legacy feature
|
||||
// !LANGUAGE: -NoConstantValueAttributeForNonConstVals
|
||||
|
||||
class C {
|
||||
val testClassVal = 100
|
||||
|
||||
@JvmField
|
||||
val testJvmFieldVal = 105
|
||||
|
||||
companion object {
|
||||
val testCompanionObjectVal = 110
|
||||
|
||||
@JvmStatic
|
||||
val testJvmStaticCompanionObjectVal = 120
|
||||
|
||||
@JvmField
|
||||
val testJvmFieldCompanionObjectVal = 130
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface IFoo {
|
||||
companion object {
|
||||
val testInterfaceCompanionObjectVal = 200
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface IBar {
|
||||
companion object {
|
||||
@JvmField
|
||||
val testJvmFieldInInterfaceCompanionObject = 210
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
object Obj {
|
||||
val testObjectVal = 300
|
||||
|
||||
@JvmStatic
|
||||
val testJvmStaticObjectVal = 310
|
||||
|
||||
@JvmField
|
||||
val testJvmFieldObjectVal = 320
|
||||
}
|
||||
|
||||
|
||||
val testTopLevelVal = 400
|
||||
|
||||
|
||||
// 1 final I testClassVal = 100
|
||||
// 1 final I testJvmFieldVal = 105
|
||||
// 1 final static I testCompanionObjectVal = 110
|
||||
// 1 final static I testJvmStaticCompanionObjectVal = 120
|
||||
// 1 final static I testJvmFieldCompanionObjectVal = 130
|
||||
// 1 final static I testInterfaceCompanionObjectVal = 200
|
||||
// 1 final static I testJvmFieldInInterfaceCompanionObject = 210
|
||||
// 1 final static I testObjectVal = 300
|
||||
// 1 final static I testJvmStaticObjectVal = 310
|
||||
// 1 final static I testJvmFieldObjectVal = 320
|
||||
// 1 final static I testTopLevelVal = 400
|
||||
Reference in New Issue
Block a user