[JS] Forbid export of interfaces

With the only exception of external interfaces.

See https://youtrack.jetbrains.com/issue/KT-44099
This commit is contained in:
Shagen Ogandzhanian
2020-12-29 20:43:57 +01:00
parent a6534c4653
commit 55a5695fc0
6 changed files with 30 additions and 9 deletions
@@ -20,7 +20,7 @@ open class ExportedGenericClass<T>
class <!NON_EXPORTABLE_TYPE("super; ExportedGenericClass<NonExportedClass>")!>ExportedClass3<!> : ExportedGenericClass<NonExportedClass>()
@JsExport
interface ExportedGenericInterface<T>
interface <!WRONG_EXPORTED_DECLARATION!>ExportedGenericInterface<!><T>
@JsExport
class <!NON_EXPORTABLE_TYPE("super; ExportedGenericInterface<NonExportedClass>")!>ExportedClass4<!> : ExportedGenericInterface<NonExportedClass>
@@ -14,4 +14,4 @@ fun <<!NON_EXPORTABLE_TYPE("upper bound; C")!>T : C<!>>foo() { }
class A<<!NON_EXPORTABLE_TYPE("upper bound; C")!>T : C<!>, <!NON_EXPORTABLE_TYPE("upper bound; I")!>S: I<!>>
@JsExport
interface I2<<!NON_EXPORTABLE_TYPE("upper bound; C"), NON_EXPORTABLE_TYPE("upper bound; I")!>T<!>> where T : C, T : I
interface <!WRONG_EXPORTED_DECLARATION!>I2<!><<!NON_EXPORTABLE_TYPE("upper bound; C"), NON_EXPORTABLE_TYPE("upper bound; I")!>T<!>> where T : C, T : I
@@ -18,3 +18,9 @@ enum class <!WRONG_EXPORTED_DECLARATION("enum class")!>EnumClass<!> { ENTRY1, EN
@JsExport
annotation class <!WRONG_EXPORTED_DECLARATION("annotation class")!>AnnotationClass<!>
@JsExport
interface <!WRONG_EXPORTED_DECLARATION("interface")!>SomeInterface<!>
@JsExport
external interface GoodInterface
@@ -30,4 +30,16 @@ package foo {
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): foo.EnumClass
public final /*synthesized*/ fun values(): kotlin.Array<foo.EnumClass>
}
@kotlin.js.JsExport public external interface GoodInterface {
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
}
@kotlin.js.JsExport public interface SomeInterface {
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
}
}