Files
kotlin/compiler/testData/diagnostics/tests/enum/InsideEntryConstructorCall.kt
Mikhail Glukhikh 3c7225e83a An implementation of KT-7753: now enum constructors cannot be called explicitly.
Several tests are provided.
 #KT-7753 Fixed.
2015-05-25 17:27:31 +03:00

15 lines
349 B
Kotlin
Vendored

// KT-7753: attempt to call enum constructor explicitly
enum class A(val c: Int) {
ONE(1) {
override fun selfOrFriend(): A {
return this
}
},
TWO(2) {
override fun selfOrFriend(): A {
return <!ENUM_CLASS_CONSTRUCTOR_CALL!>A(42)<!>
}
};
abstract fun selfOrFriend(): A
}