[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:
+10
-6
@@ -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
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
|
||||
@JsExport
|
||||
interface I {
|
||||
fun ok(): String
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user