[FIR] Support ENUM_CLASS_CONSTRUCTOR_CALL

^KT-59411 Fixed
This commit is contained in:
Nikolay Lunyak
2023-07-18 07:38:40 +03:00
committed by Space Team
parent f4ffd479cc
commit e4246e8f51
15 changed files with 46 additions and 55 deletions
@@ -6,5 +6,5 @@ enum class A(val c: Int) {
fun createA(): A {
// Error should be here!
return <!INVISIBLE_REFERENCE!>A<!>(10)
return <!ENUM_CLASS_CONSTRUCTOR_CALL!><!INVISIBLE_REFERENCE!>A<!>(10)<!>
}
@@ -1,10 +0,0 @@
// KT-7753: attempt to call enum constructor explicitly
enum class A(val c: Int) {
ONE(1),
TWO(2);
fun createA(): A {
// Error should be here!
return A(10)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-7753: attempt to call enum constructor explicitly
enum class A(val c: Int) {
ONE(1),
@@ -1,15 +0,0 @@
// 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 A(42)
}
};
abstract fun selfOrFriend(): A
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-7753: attempt to call enum constructor explicitly
enum class A(val c: Int) {
ONE(1) {
@@ -1,13 +0,0 @@
// KT-7753: attempt to call enum constructor explicitly
enum class A(val c: Int) {
ONE(1),
TWO(2),
THREE(3),
FORTY_TWO();
var last: A? = null
constructor(): this(42) {
last = A(13)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-7753: attempt to call enum constructor explicitly
enum class A(val c: Int) {
ONE(1),