Skip to content

Commit 3af78ae

Browse files
committed
Revert and always use merged symbol to get members of late bound symbol
Fixes microsoft#30891
1 parent 3c67608 commit 3af78ae

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6607,11 +6607,12 @@ namespace ts {
66076607
* unique symbol type which we can then use as the name of the member. This allows users
66086608
* to define custom symbols that can be used in the members of an object type.
66096609
*
6610+
* @param parent The containing symbol for the member.
66106611
* @param earlySymbols The early-bound symbols of the parent.
66116612
* @param lateSymbols The late-bound symbols of the parent.
66126613
* @param decl The member to bind.
66136614
*/
6614-
function lateBindMember(earlySymbols: SymbolTable | undefined, lateSymbols: SymbolTable, decl: LateBoundDeclaration) {
6615+
function lateBindMember(parent: Symbol, earlySymbols: SymbolTable | undefined, lateSymbols: SymbolTable, decl: LateBoundDeclaration) {
66156616
Debug.assert(!!decl.symbol, "The member is expected to have a symbol.");
66166617
const links = getNodeLinks(decl);
66176618
if (!links.resolvedSymbol) {
@@ -6642,7 +6643,6 @@ namespace ts {
66426643
}
66436644
lateSymbol.nameType = type;
66446645
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
6645-
const parent = getSymbolOfNode(decl.parent);
66466646
if (lateSymbol.parent) {
66476647
Debug.assert(lateSymbol.parent === parent, "Existing symbol parent should match new one");
66486648
}
@@ -6652,15 +6652,6 @@ namespace ts {
66526652
return links.resolvedSymbol = lateSymbol;
66536653
}
66546654
}
6655-
else {
6656-
const type = checkComputedPropertyName(decl.name);
6657-
if (isTypeUsableAsPropertyName(type)) {
6658-
const memberName = getPropertyNameFromType(type);
6659-
if (!lateSymbols.has(memberName)) {
6660-
lateSymbols.set(memberName, links.resolvedSymbol);
6661-
}
6662-
}
6663-
}
66646655
return links.resolvedSymbol;
66656656
}
66666657

@@ -6684,7 +6675,7 @@ namespace ts {
66846675
if (members) {
66856676
for (const member of members) {
66866677
if (isStatic === hasStaticModifier(member) && hasLateBindableName(member)) {
6687-
lateBindMember(earlySymbols, lateSymbols, member);
6678+
lateBindMember(symbol, earlySymbols, lateSymbols, member);
66886679
}
66896680
}
66906681
}
@@ -6718,11 +6709,12 @@ namespace ts {
67186709
const links = getSymbolLinks(symbol);
67196710
if (!links.lateSymbol && some(symbol.declarations, hasLateBindableName)) {
67206711
// force late binding of members/exports. This will set the late-bound symbol
6712+
const parent = getMergedSymbol(symbol.parent)!;
67216713
if (some(symbol.declarations, hasStaticModifier)) {
6722-
getExportsOfSymbol(symbol.parent!);
6714+
getExportsOfSymbol(parent);
67236715
}
67246716
else {
6725-
getMembersOfSymbol(symbol.parent!);
6717+
getMembersOfSymbol(parent);
67266718
}
67276719
}
67286720
return links.lateSymbol || (links.lateSymbol = symbol);

0 commit comments

Comments
 (0)