Resolve constructors declared in traits and objects

It prevents exceptions and produces less red code

 #EA-68667 Fixed
This commit is contained in:
Denis Zharkov
2015-05-29 15:58:08 +03:00
parent 7f9d2e8a36
commit 70dbbd8fda
23 changed files with 179 additions and 31 deletions
@@ -0,0 +1,24 @@
object A1<!CONSTRUCTOR_IN_OBJECT!>()<!> {
<!CONSTRUCTOR_IN_OBJECT!>constructor(x: Int = <!TYPE_MISMATCH!>""<!>, y: Int)<!> : this() {
x + y
}
}
object A2 public <!CONSTRUCTOR_IN_OBJECT!>constructor(private val prop: Int)<!> {
<!CONSTRUCTOR_IN_OBJECT!>constructor(x: Int = <!TYPE_MISMATCH!>""<!>, y: Int)<!> : this(x * y) {
x + y
}
}
val x = object <!CONSTRUCTOR_IN_OBJECT!>(val prop: Int)<!> {
<!CONSTRUCTOR_IN_OBJECT!>constructor()<!> : this(1) {
val x = 1
x * x
}
}
class A3 {
companion object B<!CONSTRUCTOR_IN_OBJECT!>(val prop: Int)<!> {
<!CONSTRUCTOR_IN_OBJECT!>public constructor()<!> : this(2)
}
}
@@ -0,0 +1,36 @@
package
internal val x: kotlin.Any
internal object A1 {
private constructor A1()
private constructor A1(/*0*/ x: kotlin.Int = ..., /*1*/ y: 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
}
internal object A2 {
public constructor A2(/*0*/ prop: kotlin.Int)
private constructor A2(/*0*/ x: kotlin.Int = ..., /*1*/ y: kotlin.Int)
private final val prop: 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
}
internal final class A3 {
public constructor A3()
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 companion object B {
public constructor B()
private constructor B(/*0*/ prop: kotlin.Int)
internal final val prop: 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
}
}
@@ -83,6 +83,7 @@ internal interface T2</*0*/ T> {
}
internal interface Test {
public constructor Test()
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,14 +1,16 @@
// !DIAGNOSTICS: -MISSING_CONSTRUCTOR_KEYWORD
class C(val a: String) {}
interface T1<!CONSTRUCTOR_IN_TRAIT!>(val x: String)<!> {}
interface T2<!CONSTRUCTOR_IN_TRAIT!>()<!> {}
interface T2 <!CONSTRUCTOR_IN_TRAIT!>constructor()<!> {}
interface T3 private <!CONSTRUCTOR_IN_TRAIT!>constructor(<!UNUSED_PARAMETER!>a<!>: Int)<!> {}
interface T4 {
<!CONSTRUCTOR_IN_TRAIT!>constructor(a: <!DEBUG_INFO_MISSING_UNRESOLVED!>Int<!>)<!> {
val b: <!DEBUG_INFO_MISSING_UNRESOLVED!>Int<!> = 1
<!CONSTRUCTOR_IN_TRAIT!>constructor(<!UNUSED_PARAMETER!>a<!>: Int)<!> {
val <!UNUSED_VARIABLE!>b<!>: Int = 1
}
}
@@ -17,6 +17,7 @@ internal interface T1 {
}
internal interface T2 {
public constructor T2()
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
@@ -30,18 +31,21 @@ internal interface T3 {
}
internal interface T4 {
public constructor T4(/*0*/ a: 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
}
internal interface T5 : T4 {
private constructor T5()
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 interface T6 : T5 {
private constructor T6()
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
@@ -3,6 +3,7 @@ package
internal val anonObject: kotlin.Any
internal object A {
private constructor A()
private 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
@@ -11,6 +12,7 @@ internal object A {
internal final enum class B : kotlin.Enum<B> {
public enum entry X : B {
private constructor X()
private constructor X()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: B): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -40,6 +42,7 @@ internal final class C {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal companion object Companion {
private constructor Companion()
private constructor Companion()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,6 +1,7 @@
package
internal interface 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
@@ -6,5 +6,5 @@ interface Foo<!CONSTRUCTOR_IN_TRAIT!>()<!> : <!TRAIT_WITH_SUPERCLASS!>bar<!><!SU
interface Foo2 : <!TRAIT_WITH_SUPERCLASS!>bar<!>, Foo {
}
open class Foo1() : bar(), <!SUPERTYPE_NOT_INITIALIZED, MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, Foo, <!SUPERTYPE_APPEARS_TWICE!>Foo<!><!NO_CONSTRUCTOR!>()<!> {}
open class Foo1() : bar(), <!SUPERTYPE_NOT_INITIALIZED, MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!>, Foo, <!SUPERTYPE_APPEARS_TWICE!>Foo<!>() {}
open class Foo12 : bar(), <!SUPERTYPE_NOT_INITIALIZED, MANY_CLASSES_IN_SUPERTYPE_LIST, SUPERTYPE_APPEARS_TWICE!>bar<!> {}
@@ -1,6 +1,7 @@
package
internal interface Foo : bar, bar, bar {
public constructor Foo()
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