use smart cast info while adding constraint for receiver

This commit is contained in:
Svetlana Isakova
2013-12-19 20:18:14 +04:00
parent b4dbd69d23
commit cfb7bcb73b
3 changed files with 22 additions and 0 deletions
@@ -0,0 +1,13 @@
trait A
trait B
class Test {
fun test(a: A?, b: B, list: MutableList<Pair<A, B>>) {
if (a != null) {
list.add(<!DEBUG_INFO_AUTOCAST!>a<!> to b)
}
}
}
class Pair<out A, out B>(val first: A, val second: B)
fun <A, B> A.to(that: B) = Pair(this, that)