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,35 @@
// !CHECK_TYPE
object Outer {
private var x
get() = object : CharSequence {
override val length: Int
get() = 0
override fun get(index: Int): Char {
checkSubtype<CharSequence>(<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x<!>)
return ' '
}
override fun subSequence(startIndex: Int, endIndex: Int) = ""
fun bar() {
}
}
set(q) {
checkSubtype<CharSequence>(x)
y = q
x = q
}
private var y = <!DEBUG_INFO_LEAKING_THIS!>x<!>
fun foo() {
x = y
checkSubtype<CharSequence>(x)
checkSubtype<CharSequence>(y)
x.bar()
y.bar()
}
}