KT-5963 Call to super shouldn't require type specification if there is no conflict
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
This commit is contained in:
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Interface AnotherInterface
|
||||
// \ /
|
||||
// \/
|
||||
// DerivedInterface
|
||||
//
|
||||
|
||||
interface Interface {
|
||||
fun foo() {}
|
||||
fun ambiguous() {}
|
||||
val ambiguousProp: Int
|
||||
get() = 222
|
||||
}
|
||||
|
||||
interface AnotherInterface {
|
||||
fun ambiguous() {}
|
||||
val ambiguousProp: Int
|
||||
get() = 333
|
||||
}
|
||||
|
||||
interface DerivedInterface: Interface, AnotherInterface {
|
||||
override fun foo() { super.foo() }
|
||||
override fun ambiguous() {
|
||||
<!AMBIGUOUS_SUPER!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>ambiguous<!>()
|
||||
}
|
||||
override val ambiguousProp: Int
|
||||
get() = <!AMBIGUOUS_SUPER!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>ambiguousProp<!>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user