Files
kotlin-fork/compiler/testData/diagnostics/tests/modifiers/const/stringConcatenationWithObject.kt
T
Ivan Kylchik 5b16b2c71e Properly verify args in string concatenation expression for interpreter
If string concatenation contains object value, then this argument
will not have explicit toString call. We must find and check toString
method manually.

#KT-54615
2022-10-24 13:14:16 +00:00

19 lines
613 B
Kotlin
Vendored

// FIR_IDENTICAL
object O : Code(0)
open class Code(val x: Int) {
override fun toString() = "$x"
}
class A {
companion object: Code(0)
}
const val toString1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>O.toString()<!>
const val toString2 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>A.toString()<!>
const val plusString1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"string" + O<!>
const val plusString2 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"string" + A<!>
const val stringConcat1 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"$O"<!>
const val stringConcat2 = <!CONST_VAL_WITH_NON_CONST_INITIALIZER!>"$A"<!>