046189087a
Implemented unqualified 'super' type resolution (in BasicExpressionTypingVisitor). No overload resolution of any kind is involved. Corresponding supertype is determined by the expected member name only: - 'super.foo(...)' - function or property (of possibly callable type) 'foo' - 'super.x' - property 'x' Supertype should provide a non-abstract implementation of such member. As a fall-back solution for diagnostics purposes, consider supertypes with abstract implementation of such member. Diagnostics: - AMBIGUOUS_SUPER on 'super', if multiple possible supertypes are available; - ABSTRACT_SUPER_CALL on selector expression, if the only available implementation is abstract. #KT-5963 Fixed
58 lines
1.0 KiB
Kotlin
Vendored
58 lines
1.0 KiB
Kotlin
Vendored
// Base Interface
|
|
// \ /
|
|
// \/
|
|
// Derived
|
|
//
|
|
|
|
open class Base() {
|
|
open fun foo() {}
|
|
|
|
open fun ambiguous() {}
|
|
|
|
open val prop: Int
|
|
get() = 1234
|
|
|
|
open val ambiguousProp: Int
|
|
get() = 111
|
|
}
|
|
|
|
interface Interface {
|
|
fun bar() {}
|
|
|
|
fun ambiguous() {}
|
|
|
|
val ambiguousProp: Int
|
|
get() = 222
|
|
}
|
|
|
|
class Derived : Base(), Interface {
|
|
override fun foo() {}
|
|
override fun bar() {}
|
|
|
|
override fun ambiguous() {}
|
|
|
|
override val ambiguousProp: Int
|
|
get() = 333
|
|
|
|
override val prop: Int
|
|
get() = 4321
|
|
|
|
fun callsFunFromSuperClass() {
|
|
super.foo()
|
|
}
|
|
|
|
fun getSuperProp(): Int =
|
|
super.prop
|
|
|
|
fun getAmbiguousSuperProp(): Int =
|
|
<!AMBIGUOUS_SUPER!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>ambiguousProp<!>
|
|
|
|
fun callsFunFromSuperInterface() {
|
|
super.bar()
|
|
}
|
|
|
|
fun callsAmbiguousSuperFun() {
|
|
<!AMBIGUOUS_SUPER!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>ambiguous<!>()
|
|
}
|
|
}
|