Files
kotlin-fork/compiler/testData/diagnostics/tests/scopes/protectedVisibility/unstableSmartCast.kt
T
2017-11-29 02:54:26 +03:00

20 lines
455 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !CHECK_TYPE
open class BaseOuter {
protected fun foo() = 1
protected fun bar() { }
}
class Foo(var base: BaseOuter)
fun BaseOuter.foo(): String = ""
class Derived : BaseOuter() {
fun test(foo: Foo) {
if (foo.base is Derived) {
foo.base.foo() checkType { _<String>() } // Resolved to extension
<!OI;SMARTCAST_IMPOSSIBLE!>foo.base<!>.<!NI;INVISIBLE_MEMBER!>bar<!>()
}
}
}