Report warning from backend if constant expression cannot be evaluated
This commit is contained in:
+4
-2
@@ -1,5 +1,7 @@
|
||||
/exceptionFromInterpreter_ir.kt:6:26: error: Cannot evaluate constant expression: / by zero
|
||||
|
||||
/exceptionFromInterpreter_ir.kt:7:39: error: Cannot evaluate constant expression: marginPrefix must be non-blank string.
|
||||
/exceptionFromInterpreter_ir.kt:7:26: warning: Constant expression will throw an exception at runtime: / by zero
|
||||
|
||||
/exceptionFromInterpreter_ir.kt:11:4: error: Cannot evaluate constant expression: / by zero
|
||||
/exceptionFromInterpreter_ir.kt:8:39: error: Cannot evaluate constant expression: marginPrefix must be non-blank string.
|
||||
|
||||
/exceptionFromInterpreter_ir.kt:12:4: error: Cannot evaluate constant expression: / by zero
|
||||
+2
-1
@@ -4,9 +4,10 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
const val divideByZero = <!EXCEPTION_IN_CONST_VAL_INITIALIZER!>1 / 0<!>
|
||||
val disivionByZeroWarn = <!EXCEPTION_IN_CONST_EXPRESSION!>1 / 0<!>
|
||||
const val trimMarginException = "123".<!EXCEPTION_IN_CONST_VAL_INITIALIZER!>trimMargin(" ")<!>
|
||||
|
||||
annotation class A(val i: Int, val b: Int)
|
||||
|
||||
@A(<!EXCEPTION_IN_CONST_VAL_INITIALIZER!>1 / 0<!>, 2)
|
||||
fun foo() {}
|
||||
fun foo() {}
|
||||
|
||||
Reference in New Issue
Block a user