Files
kotlin/compiler/testData/diagnostics/tests/objects/Objects.kt
Denis Zharkov f07566d30d Add warning for initializers with obsolete syntax
Expected 'init' keyword before class initializer
2015-03-11 17:45:26 +03:00

29 lines
483 B
Kotlin
Vendored

package toplevelObjectDeclarations
open class Foo(<!UNUSED_PARAMETER!>y<!> : Int) {
open fun foo() : Int = 1
}
class T : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {}
object A : <!SUPERTYPE_NOT_INITIALIZED!>Foo<!> {
val x : Int = 2
fun test() : Int {
return x + foo()
}
}
object B : <!SINGLETON_IN_SUPERTYPE!>A<!> {}
val x = A.foo()
val y = object : Foo(x) {
init {
x + 12
}
override fun foo() : Int = 1
}
val z = y.foo()