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:
Dmitry Petrov
2015-12-07 13:31:07 +03:00
parent 84824b1024
commit 594039ac42
17 changed files with 628 additions and 49 deletions
@@ -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>()