Allow secondary constructors without body

#KT-6967 Fixed
This commit is contained in:
Denis Zharkov
2015-03-20 12:59:05 +03:00
parent 3f0541924f
commit 01e5ee718f
54 changed files with 390 additions and 153 deletions
@@ -1,4 +1,4 @@
class A {
constructor() {}
constructor()
init {}
}
@@ -12,6 +12,6 @@ class A {
object C {
}
constructor(x: Int) {}
constructor() : this(foo() + prop + B.bar() + B.prop + C) {}
constructor(x: Int)
constructor() : this(foo() + prop + B.bar() + B.prop + C)
}
@@ -1,15 +1,15 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(x: Int) {
constructor(x: Double): this(1) {}
constructor(x: String): this(1) {}
constructor(x: Double): this(1)
constructor(x: String): this(1)
}
val x1: A = A(1)
val x2: A = A(1.0)
val x3: A = A("abc")
class B<R> {
constructor(x: String) {}
constructor(x: R) {}
constructor(x: String)
constructor(x: R)
}
val y1: B<Int> = B(1)
@@ -1,20 +1,20 @@
object A {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
init {}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>init {}
}
enum class B {
X : B() {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>}
}
class C {
companion object {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>}
}
val anonObject = object {
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor() {}<!>
}
<!SECONDARY_CONSTRUCTOR_IN_OBJECT!>constructor()
<!>}
@@ -1,3 +1,3 @@
trait A {
<!CONSTRUCTOR_IN_TRAIT!>constructor() {}<!>
}
<!CONSTRUCTOR_IN_TRAIT!>constructor()
<!>}
@@ -3,7 +3,7 @@ annotation class Ann1
annotation class Ann2(val x: Int)
class A {
Ann1 constructor() {}
<!NO_VALUE_FOR_PARAMETER!>Ann2<!> constructor(x1: Int) {}
Ann2(2) constructor(x1: Int, x2: Int) {}
Ann1 constructor()
<!NO_VALUE_FOR_PARAMETER!>Ann2<!> constructor(x1: Int)
Ann2(2) constructor(x1: Int, x2: Int)
}
@@ -1,39 +1,39 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A1 {
constructor(): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>() {}
constructor(): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>()
}
class A2(x: Byte) {
constructor(x1: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1) {}
constructor(x1: Int, x2: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2) {}
constructor(x1: Int, x2: Int, x3: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1) {}
constructor(x1: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1)
constructor(x1: Int, x2: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2)
constructor(x1: Int, x2: Int, x3: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1)
// delegating to previously declared cycle
constructor(x1: Double): this(1) {}
constructor(x1: Double): this(1)
// delegating to cycle declared after
constructor(x1: String): this(1L) {}
constructor(x1: String): this(1L)
constructor(x1: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1L) {}
constructor(x1: Long, x2: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2L) {}
constructor(x1: Long, x2: Long, x3: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1) {}
constructor(x1: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, 1L)
constructor(x1: Long, x2: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, 2L)
constructor(x1: Long, x2: Long, x3: Long): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1)
// no cycle, just call to primary constuctor
constructor(x1: Double, x2: Double): this(x1, x2, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double, x4: Double): this(1.toByte()) {}
constructor(x1: Double, x2: Double): this(x1, x2, 1.0)
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0)
constructor(x1: Double, x2: Double, x3: Double, x4: Double): this(1.toByte())
constructor(): this("x", "y") {}
constructor(): this("x", "y")
constructor(x1: String, x2: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, "") {}
constructor(x1: String, x2: String, x3: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2) {}
constructor(x1: String, x2: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2, "")
constructor(x1: String, x2: String, x3: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x1, x2)
}
open class B(x: Byte)
class A : B {
// no cycle, just call to super constuctor
constructor(x1: Double, x2: Double): this(x1, x2, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0) {}
constructor(x1: Double, x2: Double, x3: Double, x4: Double): super(1.toByte()) {}
constructor(x1: Double, x2: Double): this(x1, x2, 1.0)
constructor(x1: Double, x2: Double, x3: Double): this(x1, x2, x3, 1.0)
constructor(x1: Double, x2: Double, x3: Double, x4: Double): super(1.toByte())
}
@@ -1,12 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
data class A1(val x: String) {
constructor(): this("") {}
constructor(): this("")
}
data class A2() {
constructor(x: String): this() {}
constructor(x: String): this()
}
data class <!PRIMARY_CONSTRUCTOR_REQUIRED_FOR_DATA_CLASS!>A3<!> {
constructor() {}
constructor()
}
@@ -1,6 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(x: Any, y: Any, z: Any) {}
constructor(x: Any, y: Any, z: Any)
constructor(x: String?, y: String?): this(x!!, <!DEBUG_INFO_SMARTCAST!>x<!>.length().toString() + y!!, "") {
<!DEBUG_INFO_SMARTCAST!>x<!>.length() + <!DEBUG_INFO_SMARTCAST!>y<!>.length()
}
@@ -2,5 +2,5 @@ trait A
class AImpl : A
class B : <!UNSUPPORTED!>A by AImpl()<!> {
constructor() {}
constructor()
}
@@ -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
}
@@ -1,8 +1,8 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(x: Int) {
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor<!>() {}
<!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>constructor<!>()
}
open class B(x: Int)
class C(x: Int) : B(x) {
constructor(): <!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>super<!>(1) {}
constructor(): <!PRIMARY_CONSTRUCTOR_DELEGATION_CALL_EXPECTED!>super<!>(1)
}
@@ -1,21 +1,21 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE
open class B<T>(x: T, y: T) {
constructor(x: T): this(x, x) {}
constructor(): this(null!!, null!!) {}
constructor(x: T): this(x, x)
constructor(): this(null!!, null!!)
}
class A0 : B<String?> {
constructor() {}
constructor(x: String): super(x) {}
constructor(x: String, y: String): super(x, y) {}
constructor()
constructor(x: String): super(x)
constructor(x: String, y: String): super(x, y)
}
class A1<R> : B<R> {
constructor() {}
constructor(x: R): super(x) {}
constructor(x: R, y: R): super(x, y) {}
constructor()
constructor(x: R): super(x)
constructor(x: R, y: R): super(x, y)
}
class A2<R> {
constructor(t: R, i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1) {}
constructor(t: R, i: Int) : <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1)
}
@@ -2,25 +2,25 @@
open class B<R1, R2>(x: R1, y: R2)
class A0<T1, T2> {
constructor(x: T1, y: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, y) {}
constructor(x: T1, y: T2): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(x, y)
constructor(x: T1, y: T2, z: T2): this(x, 1) {} // ok, delegates to constructor(x: T1, y: Int)
constructor(x: T1, y: T2, z: T2): this(x, 1) // ok, delegates to constructor(x: T1, y: Int)
constructor(x: T1, y: Int): <!NONE_APPLICABLE!>this<!>(x, "") {}
constructor(x: T1): this(x, 1) {}
constructor(x: T1, y: T2, z: String): <!NONE_APPLICABLE!>this<!>(y, x) {}
constructor(x: T1, y: Int): <!NONE_APPLICABLE!>this<!>(x, "")
constructor(x: T1): this(x, 1)
constructor(x: T1, y: T2, z: String): <!NONE_APPLICABLE!>this<!>(y, x)
}
class A1<T1, T2> : B<T1, T2> {
constructor(x: T1, y: T2): super(x, y) {}
constructor(x: T1, y: Int): super(x, <!TYPE_MISMATCH(T2; kotlin.Int)!>y<!>) {}
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(T2; T1)!>y<!>) {}
constructor(x: T1, y: T2): super(x, y)
constructor(x: T1, y: Int): super(x, <!TYPE_MISMATCH(T2; kotlin.Int)!>y<!>)
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(T2; T1)!>y<!>)
}
class A2<T1, T2> : B<T1, Int> {
constructor(x: T1, y: T2): super(x, <!TYPE_MISMATCH(kotlin.Int; T2)!>y<!>) {}
constructor(x: T1, y: Int): super(x, y) {}
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(kotlin.Int; T1)!>y<!>) {}
constructor(x: T1, y: T2, z: String): super(<!TYPE_MISMATCH(T1; T2)!>y<!>, 1) {}
constructor(x: T1, y: T2): super(x, <!TYPE_MISMATCH(kotlin.Int; T2)!>y<!>)
constructor(x: T1, y: Int): super(x, y)
constructor(x: T1, y: T1, z: T1): super(x, <!TYPE_MISMATCH(kotlin.Int; T1)!>y<!>)
constructor(x: T1, y: T2, z: String): super(<!TYPE_MISMATCH(T1; T2)!>y<!>, 1)
}
@@ -1,16 +1,16 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B<X, Y : X> {
constructor(x: X, y: Y) {}
constructor(x: X, s: String) {}
constructor(y: Y, i: Int) : this(y, "") {}
constructor(x: X, y: Y)
constructor(x: X, s: String)
constructor(y: Y, i: Int) : this(y, "")
}
class A<T1, T2 : T1> : B<T1, T2> {
constructor(x: T1, y: T2): super(x, y) {}
constructor(x: T2, y: T2, z: String): super(x, y) {}
constructor(x: T1, y: T2): super(x, y)
constructor(x: T2, y: T2, z: String): super(x, y)
constructor(x: T2, z: String, z1: String): super(x, "") {}
constructor(x: T2, z: String, z1: String, z2: String): super(x, 1) {}
constructor(x: T1, z: String, z1: String, z2: String, z3: String): super(x, "") {}
constructor(x: T1, z: String, z1: String, z2: String, z3: String, z4: String): <!NONE_APPLICABLE!>super<!>(x, 1) {}
constructor(x: T2, z: String, z1: String): super(x, "")
constructor(x: T2, z: String, z1: String, z2: String): super(x, 1)
constructor(x: T1, z: String, z1: String, z2: String, z3: String): super(x, "")
constructor(x: T1, z: String, z1: String, z2: String, z3: String, z4: String): <!NONE_APPLICABLE!>super<!>(x, 1)
}
@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(x: Int)
class A : <!SUPERTYPE_INITIALIZED_WITHOUT_PRIMARY_CONSTRUCTOR!>B(1)<!> {
constructor(): super(1) {}
constructor(): super(1)
}
@@ -11,5 +11,5 @@ class A {
}
}
class A1(val x: Int, val y: Int) {
constructor(other: A1): this(other.x, other.y) {}
constructor(other: A1): this(other.x, other.y)
}
@@ -1,3 +1,3 @@
class X<T>(val t: T) {
constructor(t: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(t) {}
constructor(t: String): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(t)
}
@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class X<T>(val t: T) {
constructor(t: T, i: Int) : <!NONE_APPLICABLE!>this<!>(i) {
}
constructor(t: T, i: Int) : <!NONE_APPLICABLE!>this<!>(i)
}
@@ -1,5 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class X<T> {
constructor(t: T, i: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1) { // no error
}
constructor(t: T, i: Int): <!CYCLIC_CONSTRUCTOR_DELEGATION_CALL!>this<!>(<!TYPE_MISMATCH!>i<!>, 1)
}
@@ -1,5 +1,5 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A<T1, T2> {
constructor(block: (T1) -> T2) {}
constructor(x: T2): this({ x }) {}
constructor(block: (T1) -> T2)
constructor(x: T2): this({ x })
}
@@ -3,11 +3,11 @@ open class B(open val parentProperty: String)
class A : B {
val myProp: String = ""
override val parentProperty: String = ""
constructor(arg: String = <!UNRESOLVED_REFERENCE!>myProp<!>): super(<!UNRESOLVED_REFERENCE!>myProp<!>) {}
constructor(x1: String, arg: String = <!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>): super(<!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>) {}
constructor(x1: String, x2: String, arg: String = <!UNRESOLVED_REFERENCE!>parentProperty<!>): super(<!UNRESOLVED_REFERENCE!>parentProperty<!>) {}
constructor(x1: String, x2: String, x3: String, arg: String = <!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>): super(<!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>) {}
constructor(x1: String, x2: String, x3: String, x4: String, arg: String = foo(<!NO_THIS!>this<!>)): super(foo(<!NO_THIS!>this<!>)) {}
constructor(x1: String, x2: String, x3: String, x4: String, x5: String, arg: String = foo(this<!UNRESOLVED_REFERENCE!>@A<!>)): super(foo(this<!UNRESOLVED_REFERENCE!>@A<!>)) {}
constructor(arg: String = <!UNRESOLVED_REFERENCE!>myProp<!>): super(<!UNRESOLVED_REFERENCE!>myProp<!>)
constructor(x1: String, arg: String = <!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>): super(<!NO_THIS!>this<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>myProp<!>)
constructor(x1: String, x2: String, arg: String = <!UNRESOLVED_REFERENCE!>parentProperty<!>): super(<!UNRESOLVED_REFERENCE!>parentProperty<!>)
constructor(x1: String, x2: String, x3: String, arg: String = <!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>): super(<!SUPER_NOT_AVAILABLE!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>parentProperty<!>)
constructor(x1: String, x2: String, x3: String, x4: String, arg: String = foo(<!NO_THIS!>this<!>)): super(foo(<!NO_THIS!>this<!>))
constructor(x1: String, x2: String, x3: String, x4: String, x5: String, arg: String = foo(this<!UNRESOLVED_REFERENCE!>@A<!>)): super(foo(this<!UNRESOLVED_REFERENCE!>@A<!>))
}
fun foo(x: A) = ""
@@ -1,4 +1,4 @@
// do not report generate empty synthetic constructor by primary as it leads to CONFLICTING_JVM_DECLARATIONS
class A(val x: Int = 1, val y: Int = 2) {
constructor(): this(0, 0) {}
constructor(): this(0, 0)
}
@@ -1,8 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(x: Int) {
}
constructor(x: Int)
}
val x = A(<!NO_VALUE_FOR_PARAMETER!>)<!>
@@ -2,5 +2,5 @@ open class B
trait C
trait D
class A : C, B, D {
constructor() {}
constructor()
}
@@ -1,27 +1,26 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class <!CONFLICTING_OVERLOADS!>A(x: String = "", y: String = "")<!> {
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y) {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y)
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
}
class B {
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!> {}
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!>
}
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
class Outer {
class <!CONFLICTING_OVERLOADS!>A(x: String = "", y: String = "")<!> {
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y) {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "") {}
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y)
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
}
class B {
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!> {
}
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!>
}
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
@@ -1,11 +1,11 @@
class <!REDECLARATION!>A<!>
class <!REDECLARATION!>A<!> {
constructor() {}
constructor()
}
class B
class Outer {
class B {
constructor() {}
constructor()
}
}
@@ -1,4 +1,4 @@
class A {
val prop: Int = <!TYPE_MISMATCH!>""<!>
constructor() {}
constructor()
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(): super(<!TOO_MANY_ARGUMENTS!>1<!>) { }
constructor(): super(<!TOO_MANY_ARGUMENTS!>1<!>)
}
@@ -1,10 +1,10 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(x: Double) {
constructor(x: Int): this(1.0) {}
constructor(x: String): this(1.0) {}
constructor(x: Int): this(1.0)
constructor(x: String): this(1.0)
}
trait C
class A : B, C {
constructor(): <!NONE_APPLICABLE!>super<!>(' ') { }
<!NONE_APPLICABLE!>constructor<!>(x: Int) { }
constructor(): <!NONE_APPLICABLE!>super<!>(' ')
<!NONE_APPLICABLE!>constructor<!>(x: Int)
}
@@ -3,5 +3,5 @@ class A {
constructor(
<!VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER!>val<!> x: Int, y: Int,
<!VAL_OR_VAR_ON_SECONDARY_CONSTRUCTOR_PARAMETER!>var<!> z: Int,
<!ILLEGAL_MODIFIER!>public<!> a: Int) {}
<!ILLEGAL_MODIFIER!>public<!> a: Int)
}
@@ -2,11 +2,11 @@
fun <T> array(vararg x: T): Array<T> = null!!
open class B(vararg y: String) {
constructor(x: Int): this(x.toString(), *array("1"), "2") {}
constructor(x: Int): this(x.toString(), *array("1"), "2")
}
class A : B {
constructor(x: String, y: String): super(x, *array("3"), y) {}
constructor(x: String): super(x) {}
constructor(): super() {}
constructor(x: String, y: String): super(x, *array("3"), y)
constructor(x: String): super(x)
constructor(): super()
}
@@ -2,13 +2,13 @@
fun <T> array(vararg x: T): Array<T> = null!!
open class B(x: Int) {
constructor(vararg y: String): this(y[0].length()) {}
constructor(vararg y: String): this(y[0].length())
}
class A : B {
constructor(x: String, y: String): super(x, *array("q"), y) {}
constructor(x: String): super(x) {}
constructor(): super() {}
constructor(x: String, y: String): super(x, *array("q"), y)
constructor(x: String): super(x)
constructor(): super()
}
val b1 = B()