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
23 lines
674 B
Kotlin
Vendored
23 lines
674 B
Kotlin
Vendored
open class GenericBaseClass<T> {
|
|
open fun foo(x: T): T = x
|
|
}
|
|
|
|
interface GenericBaseInterface<T> {
|
|
fun bar(x: T): T = x
|
|
}
|
|
|
|
class GenericDerivedClass<T> : GenericBaseClass<T>(), GenericBaseInterface<T> {
|
|
override fun foo(x: T): T = super.foo(x)
|
|
override fun bar(x: T): T = super.bar(x)
|
|
}
|
|
|
|
class SpecializedDerivedClass : GenericBaseClass<Int>(), GenericBaseInterface<String> {
|
|
override fun foo(x: Int): Int = super.foo(x)
|
|
override fun bar(x: String): String = super.bar(x)
|
|
}
|
|
|
|
class MixedDerivedClass<T> : GenericBaseClass<Int>(), GenericBaseInterface<T> {
|
|
override fun foo(x: Int): Int = super.foo(x)
|
|
override fun bar(x: T): T = super.bar(x)
|
|
}
|