diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/export/extendingNonExportedType.kt b/compiler/testData/diagnostics/testsWithJsStdLib/export/extendingNonExportedType.kt index 7a0064ca898..37ace185ed5 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/export/extendingNonExportedType.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/export/extendingNonExportedType.kt @@ -20,7 +20,7 @@ open class ExportedGenericClass class ")!>ExportedClass3 : ExportedGenericClass() @JsExport -interface ExportedGenericInterface +interface ExportedGenericInterface @JsExport class ")!>ExportedClass4 : ExportedGenericInterface diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/export/unexportableTypesInTypeParameters.kt b/compiler/testData/diagnostics/testsWithJsStdLib/export/unexportableTypesInTypeParameters.kt index f6c80bbecab..824fd1a77de 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/export/unexportableTypesInTypeParameters.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/export/unexportableTypesInTypeParameters.kt @@ -14,4 +14,4 @@ fun <T : C>foo() { } class A<T : C, S: I> @JsExport -interface I2<T> where T : C, T : I +interface I2<T> where T : C, T : I diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.kt b/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.kt index 09806d4c83b..bc84713c50e 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.kt @@ -18,3 +18,9 @@ enum class EnumClass { ENTRY1, EN @JsExport annotation class AnnotationClass + +@JsExport +interface SomeInterface + +@JsExport +external interface GoodInterface diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.txt b/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.txt index f7459275d85..f45ea89aa8f 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclaration.txt @@ -30,4 +30,16 @@ package foo { public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): foo.EnumClass public final /*synthesized*/ fun values(): kotlin.Array } + + @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 + } } diff --git a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt index c9649eedc20..f45bf578910 100644 --- a/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt +++ b/js/js.frontend/src/org/jetbrains/kotlin/js/resolve/diagnostics/JsExportDeclarationChecker.kt @@ -107,14 +107,18 @@ object JsExportDeclarationChecker : DeclarationChecker { checkTypeParameter(typeParameter) } - if (descriptor.kind == ENUM_CLASS) { - reportWrongExportedDeclaration("enum class") - return - } - if (descriptor.kind == ANNOTATION_CLASS) { - reportWrongExportedDeclaration("annotation class") + val wrongDeclaration: String? = when (descriptor.kind) { + ENUM_CLASS -> "enum class" + INTERFACE -> if (descriptor.isExternal) null else "interface" + ANNOTATION_CLASS -> "annotation class" + else -> null + } + + if (wrongDeclaration != null) { + reportWrongExportedDeclaration(wrongDeclaration) return } + if (descriptor.kind == ENUM_ENTRY) { // Covered by ENUM_CLASS return diff --git a/js/js.translator/testData/box/inline/inlinedObjectLiteralIsCheck.kt b/js/js.translator/testData/box/inline/inlinedObjectLiteralIsCheck.kt index 8eea3699096..8eece0a7b85 100644 --- a/js/js.translator/testData/box/inline/inlinedObjectLiteralIsCheck.kt +++ b/js/js.translator/testData/box/inline/inlinedObjectLiteralIsCheck.kt @@ -1,6 +1,5 @@ // EXPECTED_REACHABLE_NODES: 1282 -@JsExport interface I { fun ok(): String }