Add UL support for const fields initializers

Fixed #KT-34081
This commit is contained in:
Igor Yakovlev
2019-11-22 21:34:44 +03:00
parent 775eb67219
commit 0ff77bd3c5
6 changed files with 82 additions and 37 deletions

View File

@@ -45,7 +45,7 @@ final class null /* null*/ {
@null()
public static final java.lang.Object INSTANCE;
private static final java.lang.String fy /* constant value text */;
private static final java.lang.String fy = "text" /* initializer type: java.lang.String */ /* constant value text */;
@org.jetbrains.annotations.NotNull()
public final java.lang.String getFy();
@@ -104,7 +104,7 @@ final class null /* null*/ {
@null()
public static final java.lang.Object INSTANCE;
private static final java.lang.String fy /* constant value text */;
private static final java.lang.String fy = "text" /* initializer type: java.lang.String */ /* constant value text */;
@org.jetbrains.annotations.NotNull()
public final java.lang.String getFy();

View File

@@ -29,3 +29,25 @@ object Obj : java.lang.Runnable {
override fun run() {}
@JvmStatic fun zoo(): Int = 2
}
object ConstContainer {
const val str = "one" // String
const val one = 1 // Int
const val oneLong = 1L // Long
const val complexLong = 1L + 1 // Long
const val e = 2.7182818284 // Double
const val eFloat = 2.7182818284f // Float
const val complexFloat = 2.7182818284f + 2.4 // Float
}
class ClassWithConstContainer {
companion object {
const val str = "one" // String
const val one = 1 // Int
const val oneLong = 1L // Long
const val complexLong = 1L + 1 // Long
const val e = 2.7182818284 // Double
const val eFloat = 2.7182818284f // Float
const val complexFloat = 2.7182818284f + 2.4 // Float
}
}