An implementation of KT-7753: now enum constructors cannot be called explicitly.

Several tests are provided.
 #KT-7753 Fixed.
This commit is contained in:
Mikhail Glukhikh
2015-05-19 15:01:33 +03:00
parent 8cf21f24cd
commit 3c7225e83a
16 changed files with 402 additions and 3 deletions
@@ -0,0 +1,15 @@
// 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
}