[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))
|
members.addIfNotNull(exportProperty(candidate)?.withAttributesFor(candidate))
|
||||||
|
|
||||||
is IrClass -> {
|
is IrClass -> {
|
||||||
|
if (klass.isInterface) continue
|
||||||
val ec = exportClass(candidate)?.withAttributesFor(candidate)
|
val ec = exportClass(candidate)?.withAttributesFor(candidate)
|
||||||
if (ec is ExportedClass) {
|
if (ec is ExportedClass) {
|
||||||
nestedClasses.add(ec)
|
nestedClasses.add(ec)
|
||||||
|
|||||||
+5
@@ -31,5 +31,10 @@ declare namespace JS_TESTS {
|
|||||||
}
|
}
|
||||||
function processInterface(test: foo.TestInterface): string;
|
function processInterface(test: foo.TestInterface): string;
|
||||||
function processOptionalInterface(a: foo.OptionalFieldsInterface): string;
|
function processOptionalInterface(a: foo.OptionalFieldsInterface): string;
|
||||||
|
interface InterfaceWithCompanion {
|
||||||
|
readonly __doNotUseOrImplementIt: {
|
||||||
|
readonly "foo.InterfaceWithCompanion": unique symbol;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
@@ -46,3 +46,13 @@ external interface OptionalFieldsInterface {
|
|||||||
fun processOptionalInterface(a: OptionalFieldsInterface): String {
|
fun processOptionalInterface(a: OptionalFieldsInterface): String {
|
||||||
return "${a.required}${a.notRequired ?: "unknown"}"
|
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 processInterface(test: foo.TestInterface): string;
|
||||||
function processOptionalInterface(a: foo.OptionalFieldsInterface): string;
|
function processOptionalInterface(a: foo.OptionalFieldsInterface): string;
|
||||||
|
interface InterfaceWithCompanion {
|
||||||
|
readonly __doNotUseOrImplementIt: {
|
||||||
|
readonly "foo.InterfaceWithCompanion": unique symbol;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,3 +42,13 @@ external interface OptionalFieldsInterface {
|
|||||||
fun processOptionalInterface(a: OptionalFieldsInterface): String {
|
fun processOptionalInterface(a: OptionalFieldsInterface): String {
|
||||||
return "${a.required}${a.notRequired ?: "unknown"}"
|
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