Secondary constructors delegation calls and body resolve

This commit is contained in:
Denis Zharkov
2015-02-03 14:14:37 +03:00
parent b2cecf1dd0
commit 1555eec954
71 changed files with 1093 additions and 50 deletions
@@ -0,0 +1,25 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(open val parentProp: Int)
val global: Int = 1
class A : <!SUPERTYPE_NOT_INITIALIZED!>B<!> {
val myProp: Int = 1
override val parentProp = 1
constructor(x: Int, y: Int = global): super(x + y + global) {
foo(x, y, myProp)
x + y + myProp + parentProp + super.parentProp
}
constructor(x: Double, y: Int): this(x.toInt() + y, x.toInt() * y) {
foo(x.toInt(), y, myProp)
x + y + myProp + parentProp + super.parentProp
}
constructor(x: String, y: Int): super(<!TYPE_MISMATCH!>x<!>) {
foo(<!TYPE_MISMATCH!>x<!>, y, myProp)
x + y + myProp + parentProp + super.parentProp
}
constructor(x: B, y: Int = <!UNRESOLVED_REFERENCE!>global2<!>): <!NONE_APPLICABLE!>this<!>("", x) {
x.parentProp + y + myProp + parentProp + super.parentProp
}
fun foo(x: Int, y: Int, z: Int) = x
}
@@ -0,0 +1,24 @@
package
internal val global: kotlin.Int = 1
internal final class A : B {
public constructor A(/*0*/ x: B, /*1*/ y: kotlin.Int = ...)
public constructor A(/*0*/ x: kotlin.Double, /*1*/ y: kotlin.Int)
public constructor A(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int = ...)
public constructor A(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Int)
internal final val myProp: kotlin.Int = 1
internal open override /*1*/ val parentProp: kotlin.Int = 1
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int, /*2*/ z: kotlin.Int): kotlin.Int
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*/ parentProp: kotlin.Int)
internal open val parentProp: kotlin.Int
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
}
@@ -1,7 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A(x: Int) {
constructor(x: Double) {}
constructor(x: String) {}
constructor(x: Double): this(1) {}
constructor(x: String): this(1) {}
}
val x1: A = A(1)
val x2: A = A(1.0)
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B<T>(x: T, y: T) {
constructor(x: T): this(x, x) {}
constructor(): this(null) {}
}
class A0 : B<String?> {
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) {}
}
@@ -0,0 +1,28 @@
package
internal final class A0 : B<kotlin.String?> {
public constructor A0()
public constructor A0(/*0*/ x: kotlin.String)
public constructor A0(/*0*/ x: kotlin.String, /*1*/ y: 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 final class A1</*0*/ R> : B<R> {
public constructor A1</*0*/ R>()
public constructor A1</*0*/ R>(/*0*/ x: R)
public constructor A1</*0*/ R>(/*0*/ x: R, /*1*/ y: R)
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</*0*/ T> {
public constructor B</*0*/ T>()
public constructor B</*0*/ T>(/*0*/ x: T)
public constructor B</*0*/ T>(/*0*/ x: T, /*1*/ y: T)
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
}
@@ -0,0 +1,13 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(open val parentProperty: String)
class A : <!SUPERTYPE_NOT_INITIALIZED!>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<!>)) {}
}
fun foo(x: A) = ""
@@ -0,0 +1,25 @@
package
internal fun foo(/*0*/ x: A): kotlin.String
internal final class A : B {
public constructor A(/*0*/ arg: kotlin.String = ...)
public constructor A(/*0*/ x1: kotlin.String, /*1*/ arg: kotlin.String = ...)
public constructor A(/*0*/ x1: kotlin.String, /*1*/ x2: kotlin.String, /*2*/ arg: kotlin.String = ...)
public constructor A(/*0*/ x1: kotlin.String, /*1*/ x2: kotlin.String, /*2*/ x3: kotlin.String, /*3*/ arg: kotlin.String = ...)
public constructor A(/*0*/ x1: kotlin.String, /*1*/ x2: kotlin.String, /*2*/ x3: kotlin.String, /*3*/ x4: kotlin.String, /*4*/ arg: kotlin.String = ...)
public constructor A(/*0*/ x1: kotlin.String, /*1*/ x2: kotlin.String, /*2*/ x3: kotlin.String, /*3*/ x4: kotlin.String, /*4*/ x5: kotlin.String, /*5*/ arg: kotlin.String = ...)
internal final val myProp: kotlin.String = ""
internal open override /*1*/ val parentProperty: 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*/ parentProperty: kotlin.String)
internal open val parentProperty: 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
}
@@ -0,0 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(): super(<!TOO_MANY_ARGUMENTS!>1<!>) { }
}
@@ -0,0 +1,8 @@
package
internal final class A {
public constructor A()
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
}
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class B(x: Double) {
constructor(x: Int): this(1.0) {}
constructor(x: String): this(1.0) {}
}
trait C
class A : <!SUPERTYPE_NOT_INITIALIZED!>B<!>, C {
constructor(): <!NONE_APPLICABLE!>super<!>(' ') { }
constructor(x: Int) <!NONE_APPLICABLE!><!>{ }
}
@@ -0,0 +1,24 @@
package
internal final class A : B, C {
public constructor A()
public constructor A(/*0*/ x: kotlin.Int)
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
}
internal open class B {
public constructor B(/*0*/ x: kotlin.Double)
public constructor B(/*0*/ x: kotlin.Int)
public constructor B(/*0*/ x: 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 trait C {
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
}
@@ -0,0 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A {
constructor(x: Int) {}
constructor(x: String) {}
constructor(): <!NONE_APPLICABLE!>this<!>('a') {}
}
@@ -0,0 +1,10 @@
package
internal final class A {
public constructor A()
public constructor A(/*0*/ x: kotlin.Int)
public constructor A(/*0*/ x: 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
}
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> array(vararg x: T): Array<T> = null!!
open class B(vararg y: String) {
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() {}
}
@@ -0,0 +1,20 @@
package
internal fun </*0*/ T> array(/*0*/ vararg x: T /*kotlin.Array<out T>*/): kotlin.Array<T>
internal final class A : B {
public constructor A()
public constructor A(/*0*/ x: kotlin.String)
public constructor A(/*0*/ x: kotlin.String, /*1*/ y: 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*/ vararg y: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public constructor B(/*0*/ x: kotlin.Int)
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
}
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun <T> array(vararg x: T): Array<T> = null!!
open class B(x: Int) {
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() {}
}
val b1 = B()
val b2 = B("1", "2", "3")
val b3 = B("1", *array("2", "3"), "4")
val b4 = B(1)
@@ -0,0 +1,24 @@
package
internal val b1: B
internal val b2: B
internal val b3: B
internal val b4: B
internal fun </*0*/ T> array(/*0*/ vararg x: T /*kotlin.Array<out T>*/): kotlin.Array<T>
internal final class A : B {
public constructor A()
public constructor A(/*0*/ x: kotlin.String)
public constructor A(/*0*/ x: kotlin.String, /*1*/ y: 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*/ vararg y: kotlin.String /*kotlin.Array<out kotlin.String>*/)
public constructor B(/*0*/ x: kotlin.Int)
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
}