AA: introduce KtConstantEvaluationMode
This commit is contained in:
committed by
Ilya Kirillov
parent
ee23a52e54
commit
606033e1e6
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: 42
|
||||
constantValueKind: Int
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
class Test {
|
||||
val p = <expr>42 / d</expr> // uninitialized d
|
||||
const val d = 1
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: NOT_EVALUATED
|
||||
constantValueKind: NOT_EVALUATED
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: error("Division by zero")
|
||||
constantValueKind: Error
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
val p = <expr>42 / d</expr> // uninitialized d
|
||||
val d = 0 // should not raise div-by-zero error
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: NOT_EVALUATED
|
||||
constantValueKind: NOT_EVALUATED
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
const val bar : Int = 42
|
||||
}
|
||||
|
||||
fun box() {
|
||||
val t = Test()
|
||||
t.<expr>bar</expr>
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
val bar : Int = 42
|
||||
}
|
||||
|
||||
fun box() {
|
||||
val t = Test()
|
||||
t.<expr>bar</expr>
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: bar
|
||||
constant: 42
|
||||
constantValueKind: Int
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: bar
|
||||
constant: NOT_EVALUATED
|
||||
constantValueKind: NOT_EVALUATED
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: 42
|
||||
constantValueKind: Int
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
const val d = 1
|
||||
val p = <expr>42 / d</expr>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: NOT_EVALUATED
|
||||
constantValueKind: NOT_EVALUATED
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: 42
|
||||
constantValueKind: Int
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
val d = 1
|
||||
val p = <expr>42 / d</expr>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
expression: 42 / d
|
||||
constant: NOT_EVALUATED
|
||||
constantValueKind: NOT_EVALUATED
|
||||
Reference in New Issue
Block a user