Files
kotlin-fork/compiler/testData/diagnostics/tests/AnonymousInitializers.kt
T
Peter Tseng cd56678467 Change ANONYMOUS_INITIALIZER from _WITHOUT_CONSTRUCTOR to _IN_TRAIT
"since we made all classes have constructors some time ago", this error
doesn't even trigger on a class such as:
class testClass { {} }
It does trigger on a trait:
trait testTrait { {} }

Therefore, the error message should be changed to reflect the new
behavior.
However, an actual quickfix for this will be more involved. It is not a
good idea to simply delete the initializer, since it could contain
valuable code that the user wants to keep.
2013-03-08 02:11:58 -05:00

29 lines
383 B
Kotlin

trait NoC {
<!ANONYMOUS_INITIALIZER_IN_TRAIT!>{
}<!>
val a : Int get() = 1
<!ANONYMOUS_INITIALIZER_IN_TRAIT!>{
}<!>
}
class WithC() {
val x : Int
{
$x = 1
<!UNRESOLVED_REFERENCE!>$y<!> = 2
val b = x
}
val a : Int get() = 1
{
val z = <!UNRESOLVED_REFERENCE!>b<!>
val zz = x
val zzz = <!NO_BACKING_FIELD_CUSTOM_ACCESSORS!>$a<!>
}
}