Files
kotlin-fork/compiler/testData/diagnostics/tests/declarationChecks/kt559.kt
T
Svetlana Isakova 179c9ef2d6 Refactoring. Moved error checks (for abstract, super)
to CandidateResolver

 Added error SUPER_CANT_BE_EXTENSION_RECEIVER (it was SUPER_IS_NOT_AN_EXPRESSION)
2014-12-27 00:55:22 +03:00

31 lines
562 B
Kotlin

//KT-559 Forbid abstract method call through super
package kt559
abstract class A {
abstract val i : Int
abstract fun foo() : Int
fun fff() {}
}
abstract class D(): A() {
override val i : Int = 34
}
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class C<!>() : D() {
fun test() {
super.i
}
}
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
override fun foo(): Int {
super.<!ABSTRACT_SUPER_CALL!>i<!>
super.fff() //everything is ok
return super.<!ABSTRACT_SUPER_CALL!>foo<!>() //no error!!
}
}