mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 15:54:03 +00:00
These only apply when the receiver can be resolved to a constant and the margin prefix, if specified, is also a constant.
39 lines
791 B
Kotlin
Vendored
39 lines
791 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM_IR
|
|
|
|
fun constant(): String {
|
|
return """
|
|
|Hello,
|
|
|World
|
|
""".trimMargin()
|
|
}
|
|
|
|
private const val HAS_MARGIN = """Hello,
|
|
|World"""
|
|
fun interpolatedUsingConstant(): String {
|
|
return """
|
|
|Hello,
|
|
|$HAS_MARGIN
|
|
|World
|
|
""".trimMargin()
|
|
}
|
|
|
|
fun constantCustomPrefix(): String {
|
|
return """
|
|
###Hello,
|
|
###World
|
|
""".trimMargin(marginPrefix = "###")
|
|
}
|
|
|
|
private const val OCTOTHORPE = '#'
|
|
fun constantCustomPrefixInterpolatedUsingConstant(): String {
|
|
return """
|
|
#@#Hello,
|
|
#@#World
|
|
""".trimMargin(marginPrefix = "$OCTOTHORPE@$OCTOTHORPE")
|
|
}
|
|
|
|
// 3 LDC "Hello,\\nWorld"
|
|
// 1 LDC "Hello,\\nHello,\\nWorld\\nWorld"
|
|
// 0 LDC "###"
|
|
// 0 INVOKESTATIC kotlin/text/StringsKt.trimMargin
|