Files
kotlin-fork/idea/testData/checker/ClassObjects.kt
T
Mikhail Glukhikh 4bd48c4796 Regular modifier checker implemented (initial version). A set of tests fixed accordingly.
Most of modifier diagnostic is expressed by REDUNDANT_MODIFIER, INCOMPATIBLE_MODIFIERS, REPEATED_MODIFIER, WRONG_MODIFIER_TARGET, WRONG_MODIFIER_PARENT.
A set of modifier diagnostics is not in use now (but not deleted yet).
2015-08-03 19:41:50 +03:00

31 lines
605 B
Kotlin
Vendored

package Jet86
class A {
companion object {
val x = 1
}
<error descr="[MANY_COMPANION_OBJECTS] Only one companion object is allowed per class">companion</error> object Another { // error
val x = 1
}
}
class B() {
val x = 12
}
object b {
<error descr="[WRONG_MODIFIER_CONTAINING_DECLARATION] Modifier 'companion' is not applicable inside 'object'">companion</error> object {
val x = 1
}
// error
}
val a = A.x
val c = B.<error>x</error>
val d = b.<error>x</error>
val s = <error>System</error> // error
fun test() {
System.out.println()
java.lang.System.out.println()
}