mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 08:31:26 +00:00
Optimize const vals by inlining them at use sites
#KT-11734 Fixed #KT-13570 Fixed
This commit is contained in:
12
compiler/testData/codegen/bytecodeText/whenStringOptimization/inlineStringConstInsideWhen.kt
vendored
Normal file
12
compiler/testData/codegen/bytecodeText/whenStringOptimization/inlineStringConstInsideWhen.kt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
const val y = "cde"
|
||||
|
||||
fun foo(x : String) : String {
|
||||
when (x) {
|
||||
"abc", "${y}" -> return "abc_cde"
|
||||
"e" + "fg", "ghi" -> return "efg_ghi"
|
||||
}
|
||||
|
||||
return "other"
|
||||
}
|
||||
|
||||
// 1 LOOKUPSWITCH
|
||||
@@ -1,3 +1,5 @@
|
||||
// LANGUAGE_VERSION: 1.0
|
||||
|
||||
const val y = "cde"
|
||||
|
||||
fun foo(x : String) : String {
|
||||
|
||||
Reference in New Issue
Block a user