Support when mapping transformation on inlining
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
enum class X {
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
inline fun test(x: X, s: (X) -> String): String {
|
||||
return s(x)
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return test(X.A) {
|
||||
when(it) {
|
||||
X.A-> "O"
|
||||
X.B-> "K"
|
||||
}
|
||||
} + test(X.B) {
|
||||
when(it) {
|
||||
X.A-> "O"
|
||||
X.B-> "K"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
enum class X {
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
inline fun test(e: X): String {
|
||||
return when(e) {
|
||||
X.A-> "O"
|
||||
X.B-> "K"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return test(X.A) + test(X.B)
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
enum class X {
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
enum class Y {
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
inline fun test(e: X): String {
|
||||
return when(e) {
|
||||
X.A-> "O"
|
||||
X.B-> "K"
|
||||
}
|
||||
}
|
||||
|
||||
fun funForAdditionalMappingArrayInMappingFile(e: Y): String {
|
||||
return when(e) {
|
||||
Y.A-> "O"
|
||||
Y.B-> "K"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return test(X.A) + test(X.B)
|
||||
}
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
enum class X {
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
enum class Y {
|
||||
A,
|
||||
B
|
||||
}
|
||||
|
||||
fun funForAdditionalMappingArrayInMappingFile(e: Y): String {
|
||||
return when(e) {
|
||||
Y.A-> "O"
|
||||
Y.B-> "K"
|
||||
}
|
||||
}
|
||||
|
||||
inline fun test(e: X): String {
|
||||
return when(e) {
|
||||
X.A-> "O"
|
||||
X.B-> "K"
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
return test(X.A) + test(X.B)
|
||||
}
|
||||
Reference in New Issue
Block a user