Files
kotlin-fork/compiler/testData/diagnostics/tests/delegation/clashes/varOverriddenByVal.kt
T
Dmitry Petrov 594039ac42 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.
2015-12-09 17:43:48 +03:00

30 lines
649 B
Kotlin
Vendored

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>()