mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Make redundant null check optimization independent of boxing optimization algorithm.
Run DCE after each single redundant null check optimization pass.
This commit is contained in:
19
compiler/testData/codegen/bytecodeText/nullCheckOptimization/ifNullEqualsNullInline.kt
vendored
Normal file
19
compiler/testData/codegen/bytecodeText/nullCheckOptimization/ifNullEqualsNullInline.kt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun test1() {
|
||||
val n = null
|
||||
n.elvis { "X1" }
|
||||
"X2".elvis { "X3" }
|
||||
}
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 IFNULL
|
||||
// 0 IFNONNULL
|
||||
// 1 X1
|
||||
// 1 X2
|
||||
// 0 X3
|
||||
|
||||
// FILE: inline.kt
|
||||
inline fun <T : Any> T?.elvis(rhs: () -> T): T = this ?: rhs()
|
||||
Reference in New Issue
Block a user