Skip to content

Add test again #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3471,8 +3471,28 @@ namespace ts {
: getPropertyOfType(type, memberName);
}

function isLateBindingContainer(symbol: Symbol): boolean {
if (!(symbol.flags & (SymbolFlags.LateBindingContainer | SymbolFlags.Enum))) {
return false;
}

if (symbol.flags & SymbolFlags.Enum) {
const links = getSymbolLinks(symbol);
if (links.enumHasLateBoundMember === undefined) {
for (const declaration of symbol.declarations) {
if (isEnumDeclaration(declaration) && some(declaration.members, isSpreadEnumMember)) {
return links.enumHasLateBoundMember = true;
}
}
return links.enumHasLateBoundMember = false;
}
return links.enumHasLateBoundMember;
}
return true;
}

function getExportsOfSymbol(symbol: Symbol): SymbolTable {
return symbol.flags & SymbolFlags.LateBindingContainer ? getResolvedMembersOrExportsOfSymbol(symbol, MembersOrExportsResolutionKind.resolvedExports) :
return isLateBindingContainer(symbol) ? getResolvedMembersOrExportsOfSymbol(symbol, MembersOrExportsResolutionKind.resolvedExports) :
symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) :
symbol.exports || emptySymbols;
}
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4642,7 +4642,7 @@ namespace ts {
Classifiable = Class | Enum | TypeAlias | Interface | TypeParameter | Module | Alias,

/* @internal */
LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral | Function | Enum,
LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral | Function,
}

/* @internal */
Expand Down Expand Up @@ -4707,6 +4707,7 @@ namespace ts {
typeOnlyDeclaration?: TypeOnlyCompatibleAliasDeclaration | false; // First resolved alias declaration that makes the symbol only usable in type constructs
isConstructorDeclaredProperty?: boolean; // Property declared through 'this.x = ...' assignment in constructor
tupleLabelDeclaration?: NamedTupleMember | ParameterDeclaration; // Declaration associated with the tuple's label
enumHasLateBoundMember?: boolean // True if enum declaration contains spread enum member
}

/* @internal */
Expand Down