Delegation and overrides:
- Tests. - No need for a separate diagnostic message regarding return/property type conflict on override by delegation: it is always a conflict of inherited signatures.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
interface IVar {
|
||||
var foo: Int
|
||||
}
|
||||
|
||||
interface IDerived : IVar
|
||||
|
||||
interface IVal {
|
||||
val foo: Int
|
||||
}
|
||||
|
||||
class CVal : IVal {
|
||||
override val foo: Int get() = 42
|
||||
}
|
||||
|
||||
interface IValT<T> {
|
||||
val foo: T
|
||||
}
|
||||
|
||||
class CValT<T> : IValT<T> {
|
||||
override val foo: T get() = null!!
|
||||
}
|
||||
|
||||
abstract <!VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test1<!> : IVar, IVal by CVal()
|
||||
|
||||
abstract <!VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test2<!> : IVar, IValT<Int> by CValT<Int>()
|
||||
|
||||
abstract <!VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test3<!> : IDerived, IVal by CVal()
|
||||
|
||||
abstract <!VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION!>class Test4<!> : IDerived, IValT<Int> by CValT<Int>()
|
||||
Reference in New Issue
Block a user