[K/JS] Don't add nested classes generated by plugins into ExportModel for interfaces ^KT-63184 Fixed

This commit is contained in:
Artem Kobzar
2023-11-14 18:16:28 +01:00
committed by Space Team
parent 82bca7a04f
commit f4d088a886
5 changed files with 31 additions and 0 deletions
@@ -323,6 +323,7 @@ class ExportModelGenerator(val context: JsIrBackendContext, val generateNamespac
members.addIfNotNull(exportProperty(candidate)?.withAttributesFor(candidate))
is IrClass -> {
if (klass.isInterface) continue
val ec = exportClass(candidate)?.withAttributesFor(candidate)
if (ec is ExportedClass) {
nestedClasses.add(ec)
@@ -31,5 +31,10 @@ declare namespace JS_TESTS {
}
function processInterface(test: foo.TestInterface): string;
function processOptionalInterface(a: foo.OptionalFieldsInterface): string;
interface InterfaceWithCompanion {
readonly __doNotUseOrImplementIt: {
readonly "foo.InterfaceWithCompanion": unique symbol;
};
}
}
}
@@ -45,4 +45,14 @@ external interface OptionalFieldsInterface {
fun processOptionalInterface(a: OptionalFieldsInterface): String {
return "${a.required}${a.notRequired ?: "unknown"}"
}
// KT-63184
interface InterfaceWithCompanion {
// Emulate added by plugin companion like kotlinx.serialization does
@Suppress("WRONG_EXPORTED_DECLARATION")
companion object {
fun foo() = "String"
}
}
@@ -31,5 +31,10 @@ declare namespace JS_TESTS {
}
function processInterface(test: foo.TestInterface): string;
function processOptionalInterface(a: foo.OptionalFieldsInterface): string;
interface InterfaceWithCompanion {
readonly __doNotUseOrImplementIt: {
readonly "foo.InterfaceWithCompanion": unique symbol;
};
}
}
}
@@ -41,4 +41,14 @@ external interface OptionalFieldsInterface {
@JsExport
fun processOptionalInterface(a: OptionalFieldsInterface): String {
return "${a.required}${a.notRequired ?: "unknown"}"
}
// KT-63184
@JsExport
interface InterfaceWithCompanion {
// Emulate added by plugin companion like kotlinx.serialization does
@Suppress("WRONG_EXPORTED_DECLARATION")
companion object {
fun foo() = "String"
}
}