Is it thinkable to have an optimization that elimi...
# language-proposals
k
Is it thinkable to have an optimization that eliminates code for
is
checks that are always false and eliminates the check itself when it's always true? This can be useful for inline functions:
Copy code
inline fun <reified T: SomeInterface> T.foo() = when(this) {
    is Fragment -> doFragmentStuff()
    is Activity -> doActivityStuff()
    else -> throw UnsupportedOperationException()
}
👍 1