Allow inferring property type from its getter
#KT-550 Fixed
This commit is contained in:
+21
@@ -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>() }
|
||||
}
|
||||
Reference in New Issue
Block a user