Files
kotlin-fork/compiler/testData/diagnostics/tests/properties/inferenceFromGetters/objectExpression.kt
T
2022-01-17 21:27:14 +03:00

36 lines
805 B
Kotlin
Vendored

// !CHECK_TYPE
object Outer {
private var x
get() = object : CharSequence {
override val length: Int
get() = 0
override fun get(index: Int): Char {
checkSubtype<CharSequence>(<!DEBUG_INFO_MISSING_UNRESOLVED, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM_ERROR!>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()
}
}