JS: allow to omit delegated constructor call for external classes in common FE. Prohibit delegated constructor call for external classes in JS FE.

This commit is contained in:
Alexey Andreev
2016-12-20 15:01:33 +03:00
parent 02ea1a4d64
commit 1a7e8b0690
18 changed files with 160 additions and 29 deletions
@@ -0,0 +1,18 @@
// !DIAGNOSTICS: -DEBUG_INFO_MISSING_UNRESOLVED
external open class Base(x: Int) {
constructor(x: String) : <!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>this<!>(23)
constructor(x: String, y: String) : <!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>this<!>("")
}
external open class Derived1() : Base<!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>(23)<!> {
constructor(x: Byte) : <!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>super<!>(23)
constructor(x: String) : <!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>super<!>("")
constructor(x: String, y: String) : <!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>super<!>("")
}
external open class Derived2() : Base<!EXTERNAL_DELEGATED_CONSTRUCTOR_CALL!>("")<!>
@@ -0,0 +1,27 @@
package
public external open class Base {
public constructor Base(/*0*/ x: kotlin.Int)
public constructor Base(/*0*/ x: kotlin.String)
public constructor Base(/*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
}
public external open class Derived1 : Base {
public constructor Derived1()
public constructor Derived1(/*0*/ x: kotlin.Byte)
public constructor Derived1(/*0*/ x: kotlin.String)
public constructor Derived1(/*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
}
public external open class Derived2 : Base {
public constructor Derived2()
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,18 @@
external interface I
external object O : I
class Delegate {
operator fun getValue(thisRef: Any?, property: Any): String = ""
operator fun setValue(thisRef: Any?, property: Any, value: String) {}
}
external class A : <!EXTERNAL_DELEGATION!>I by O<!> {
val prop <!EXTERNAL_DELEGATION!>by Delegate()<!>
var mutableProp <!EXTERNAL_DELEGATION!>by Delegate()<!>
}
external val topLevelProp <!EXTERNAL_DELEGATION!>by Delegate()<!>
@@ -0,0 +1,34 @@
package
public external val topLevelProp: kotlin.String
public external final class A : I {
public constructor A()
public final var mutableProp: kotlin.String
public final val prop: 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
}
public final class Delegate {
public constructor Delegate()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.Any): kotlin.String
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.Any, /*2*/ value: kotlin.String): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public external interface I {
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
}
public external object O : I {
private constructor O()
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,9 +6,9 @@ interface I
external open class B
external class <!EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE!>C<!> : A()
external class <!EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE!>C<!> : A
external class <!EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE!>D<!> : B(), I
external class <!EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE!>D<!> : B, I
@native class <!EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE!>N<!> : A()
@@ -6,7 +6,7 @@ class B : A() {
<!OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS!>override fun f(x: Int)<!> {}
}
external class C : A() {
external class C : A {
override fun f(x: Int)
}
@@ -31,7 +31,7 @@ class F : D(), I {
<!OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS!>override fun f(x: Int)<!> {}
}
external class G : D(), I {
external class G : D, I {
override fun f(x: Int)
}
@@ -45,6 +45,6 @@ open external class XE {
class <!OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS_WITH_FAKE!>Y<!> : X(), I
external class YE: XE(), I
external class YE: XE, I
class Z : X(), J