Prevent circular secondary constructors delegation
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
class A1 {
|
||||
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)<!> {}
|
||||
|
||||
// delegating to previously declared cycle
|
||||
constructor(x1: Double): this(1) {}
|
||||
|
||||
|
||||
// delegating to cycle declared after
|
||||
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)<!> {}
|
||||
|
||||
// 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(): 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)<!> {}
|
||||
}
|
||||
|
||||
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()) {}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package
|
||||
|
||||
internal final class A : B {
|
||||
public constructor A(/*0*/ x1: kotlin.Double, /*1*/ x2: kotlin.Double)
|
||||
public constructor A(/*0*/ x1: kotlin.Double, /*1*/ x2: kotlin.Double, /*2*/ x3: kotlin.Double)
|
||||
public constructor A(/*0*/ x1: kotlin.Double, /*1*/ x2: kotlin.Double, /*2*/ x3: kotlin.Double, /*3*/ x4: kotlin.Double)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class A1 {
|
||||
public constructor A1()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class A2 {
|
||||
public constructor A2()
|
||||
public constructor A2(/*0*/ x: kotlin.Byte)
|
||||
public constructor A2(/*0*/ x1: kotlin.Double)
|
||||
public constructor A2(/*0*/ x1: kotlin.Double, /*1*/ x2: kotlin.Double)
|
||||
public constructor A2(/*0*/ x1: kotlin.Double, /*1*/ x2: kotlin.Double, /*2*/ x3: kotlin.Double)
|
||||
public constructor A2(/*0*/ x1: kotlin.Double, /*1*/ x2: kotlin.Double, /*2*/ x3: kotlin.Double, /*3*/ x4: kotlin.Double)
|
||||
public constructor A2(/*0*/ x1: kotlin.Int)
|
||||
public constructor A2(/*0*/ x1: kotlin.Int, /*1*/ x2: kotlin.Int)
|
||||
public constructor A2(/*0*/ x1: kotlin.Int, /*1*/ x2: kotlin.Int, /*2*/ x3: kotlin.Int)
|
||||
public constructor A2(/*0*/ x1: kotlin.Long)
|
||||
public constructor A2(/*0*/ x1: kotlin.Long, /*1*/ x2: kotlin.Long)
|
||||
public constructor A2(/*0*/ x1: kotlin.Long, /*1*/ x2: kotlin.Long, /*2*/ x3: kotlin.Long)
|
||||
public constructor A2(/*0*/ x1: kotlin.String)
|
||||
public constructor A2(/*0*/ x1: kotlin.String, /*1*/ x2: kotlin.String)
|
||||
public constructor A2(/*0*/ x1: kotlin.String, /*1*/ x2: kotlin.String, /*2*/ x3: kotlin.String)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal open class B {
|
||||
public constructor B(/*0*/ x: kotlin.Byte)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user