Add intrinsics for compile-time computing trimMargin/trimIndent

These only apply when the receiver can be resolved to a constant and the margin prefix, if specified, is also a constant.
This commit is contained in:
Jake Wharton
2019-03-07 12:22:03 -05:00
committed by Alexander Udalov
parent 2ec6ab92b5
commit 6ee987fa2e
9 changed files with 251 additions and 3 deletions
@@ -0,0 +1,20 @@
fun notConstant(arg: String): String {
return arg.trimIndent()
}
fun interpolated(arg: Int):String {
return """
Hello,
$arg
""".trimIndent()
}
fun notInvoked():String {
return """
Hello,
World
"""
}
// 1 LDC "\\n Hello,\\n World\\n "
// 2 INVOKESTATIC kotlin/text/StringsKt.trimIndent