mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Fix bug: handle missing symbol.parent for non-accessible symbol (#21834)
This commit is contained in:
parent
6dd88b39d5
commit
aa1ebda6a6
@ -712,7 +712,7 @@ namespace ts.Completions {
|
||||
function getFirstSymbolInChain(symbol: Symbol, enclosingDeclaration: Node, checker: TypeChecker): Symbol | undefined {
|
||||
const chain = checker.getAccessibleSymbolChain(symbol, enclosingDeclaration, /*meaning*/ SymbolFlags.All, /*useOnlyExternalAliasing*/ false);
|
||||
if (chain) return first(chain);
|
||||
return isModuleSymbol(symbol.parent) ? symbol : symbol.parent && getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker);
|
||||
return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker));
|
||||
}
|
||||
|
||||
function isModuleSymbol(symbol: Symbol): boolean {
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////function f() {
|
||||
//// class C {}
|
||||
//// return (c: C) => void;
|
||||
////}
|
||||
////f()(new /**/);
|
||||
|
||||
goTo.marker("");
|
||||
verify.not.completionListContains("C"); // Not accessible
|
||||
Loading…
x
Reference in New Issue
Block a user