[K/JS] Don't add nested classes generated by plugins into ExportModel for interfaces ^KT-63184 Fixed
This commit is contained in:
+1
@@ -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)
|
||||
|
||||
+5
@@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user