[K/JS] Change order of exported properties definition for non ES-classes compilation ^KT-60131 Fixed

This commit is contained in:
Artem Kobzar
2023-07-19 14:33:19 +00:00
committed by Space Team
parent dc5660d98c
commit e4bdd3560c
6 changed files with 106 additions and 1 deletions
@@ -0,0 +1,36 @@
// KT-60131
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// DONT_TARGET_EXACT_BACKEND: JS
// ES_MODULES
// MODULE: export_interface
// FILE: lib.kt
@JsExport
interface BaseInterface {
val prop: String
}
class Impl : BaseClass("foobar")
open class BaseClass(private val _prop: String) : BaseInterface {
final override val prop: String get() = _prop
}
@JsExport
fun getImpl(): BaseInterface = Impl()
@JsExport
fun getBase(): BaseInterface = BaseClass("base")
// FILE: main.mjs
// ENTRY_ES_MODULE
import { getBase, getImpl } from "./exportInterfaceWithoutClases-export_interface_v5.mjs"
export function box() {
if (getBase().prop != "base") return "fail 1";
if (getImpl().prop != "foobar") return "fail 2";
return "OK"
}
@@ -0,0 +1,33 @@
// KT-60131
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE
// SKIP_DCE_DRIVEN
// MODULE: export_interface
// FILE: lib.kt
@JsExport
interface BaseInterface {
val prop: String
}
class Impl : BaseClass("foobar")
open class BaseClass(private val _prop: String) : BaseInterface {
final override val prop: String get() = _prop
}
@JsExport
fun getImpl(): BaseInterface = Impl()
@JsExport
fun getBase(): BaseInterface = BaseClass("base")
// FILE: test.js
function box() {
if (this["export_interface"].getBase().prop != "base") return "fail 1";
if (this["export_interface"].getImpl().prop != "foobar") return "fail 2";
return "OK"
}