[JS IR] Update an error on cross-module symbol redeclaration

The temporary solution for KT-50546.

The complete solution requires the understanding,
whether a cross-module symbol redeclaration is a valid case or not.
If the case is valid, the linker symbol table logic must be reworked.
This commit is contained in:
Alexander Korepanov
2021-12-28 14:42:03 +03:00
committed by Space
parent a153a1fefb
commit 4a29a8a7af
4 changed files with 40 additions and 1 deletions
@@ -99,8 +99,11 @@ private class JsIrModuleCrossModuleReferecenceBuilder(val module: JsIrModule, va
val tagToName = module.fragments.flatMap { it.nameBindings.entries }.associate { it.key to it.value }
val resultImports = imports.associate {
val tag = it.tag
require(it.module::exportNames.isInitialized) {
// This situation appears in case of a dependent module redefine a symbol (function) from their dependency
"Cross module dependency resolution failed due to symbol '${tag.takeWhile { c -> c != '|' }}' redefinition"
}
val exportedAs = it.module.exportNames[tag]!!
val importedAs = tagToName[tag]!!
val moduleName = it.module.module.import()