Allow inferring property type from its getter

#KT-550 Fixed
This commit is contained in:
Denis Zharkov
2016-11-14 14:17:39 +03:00
parent 51a5bf9f7e
commit 6fca46a452
32 changed files with 460 additions and 38 deletions
@@ -0,0 +1,21 @@
// !CHECK_TYPE
val x get() = 1
val y get() = id(1)
val y2 get() = id(id(2))
val z get() = l("")
val z2 get() = l(id(l("")))
val <T> T.u get() = id(this)
fun <E> id(x: E) = x
fun <E> l(<!UNUSED_PARAMETER!>x<!>: E): List<E> = null!!
fun foo() {
x checkType { _<Int>() }
y checkType { _<Int>() }
y2 checkType { _<Int>() }
z checkType { _<List<String>>() }
z2 checkType { _<List<List<String>>>() }
1.u checkType { _<Int>() }
}