bdawg.io
08/23/2018, 8:51 PMinline fun foo(bar: MyType?) = if (bar != null) {
doSomething(bar)
} else {
doSomethingElse()
}
fun main(args: Array<out String>) {
foo(MyType())
}
will the compiler optimize the inlining of foo
in the main function to only include doSomething(bar)
since the compiler can guarantee that bar != null
is always the case?