Merge multiple symbols even when re-exported (#49987)

* Merge multiple symbols even when re-exported

As far as I remember, the target of `mergeSymbol` needs to be a merged
symbol, not a symbol with a mergeId that points to mergedSymbol.
However, mergeSymbolTable didn't check for this.

I can't remember if symbol tables may contain
symbols-with-mergeId. If they can, then mergeSymbolTable needs to call
getMergedSymbol on the individual targets of the merge. That's what I
did in this PR.

* Call getMergeSymbol eagerly

On the source, not target, of mergeSymbolTable's contents
This commit is contained in:
Nathan Shively-Sanders
2022-08-09 16:36:53 -07:00
committed by GitHub
parent abc2a350e6
commit dd98c17b10
6 changed files with 191 additions and 3 deletions

View File

@@ -1426,7 +1426,7 @@ namespace ts {
function mergeSymbolTable(target: SymbolTable, source: SymbolTable, unidirectional = false) {
source.forEach((sourceSymbol, id) => {
const targetSymbol = target.get(id);
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
});
}