KT-127 Support extension functions in when expressions
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
// KT-127 Support extension functions in when expressions
|
||||||
|
|
||||||
|
class Foo() {}
|
||||||
|
|
||||||
|
fun Any.equals(other : Any?) : Boolean = true
|
||||||
|
fun Any?.equals1(other : Any?) : Boolean = true
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
|
||||||
|
val command : Foo? = null
|
||||||
|
when (command) {
|
||||||
|
.equals(null) => 1; // must be resolved
|
||||||
|
?.equals(null) => 1 // same here
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user