Allow secondary constructors without body
#KT-6967 Fixed
This commit is contained in:
@@ -2,24 +2,24 @@
|
||||
enum class A {
|
||||
W: A(1) X: A(1, 2) Y: A(3.0) Z: A("") E: A()
|
||||
|
||||
constructor() {}
|
||||
constructor(x: Int) {}
|
||||
constructor(x: Int, y: Int): this(x+y) {}
|
||||
constructor(x: Double): this(x.toInt(), 1) {}
|
||||
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1) {}
|
||||
constructor()
|
||||
constructor(x: Int)
|
||||
constructor(x: Int, y: Int): this(x+y)
|
||||
constructor(x: Double): this(x.toInt(), 1)
|
||||
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1)
|
||||
}
|
||||
|
||||
enum class B(x: Int) {
|
||||
W: B(1) X: B(1, 2) Y: B(3.0) Z: B("")
|
||||
|
||||
constructor(x: Int, y: Int): this(x+y) {}
|
||||
constructor(x: Double): this(x.toInt(), 1) {}
|
||||
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1) {}
|
||||
constructor(x: Int, y: Int): this(x+y)
|
||||
constructor(x: Double): this(x.toInt(), 1)
|
||||
constructor(x: String): <!DELEGATION_SUPER_CALL_IN_ENUM_CONSTRUCTOR!>super<!>(x, 1)
|
||||
}
|
||||
|
||||
enum class C {
|
||||
EMPTY: C() // may be we should avoid explicit call here
|
||||
constructor() {}
|
||||
constructor()
|
||||
}
|
||||
|
||||
enum class D(val prop: Int) {
|
||||
@@ -33,8 +33,8 @@ enum class D(val prop: Int) {
|
||||
override fun f() = prop
|
||||
}
|
||||
|
||||
constructor(): this(1) {}
|
||||
constructor(x: String): this(x.length()) {}
|
||||
constructor(): this(1)
|
||||
constructor(x: String): this(x.length())
|
||||
|
||||
abstract fun f(): Int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user