Fixed crash when resolving a symbol on invalid private identifier in type reference (#60013)

This commit is contained in:
Mateusz Burzyński 2024-09-25 01:18:01 +02:00 committed by GitHub
parent aa9df4d687
commit e962037df3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View File

@ -49143,15 +49143,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
return resolveJSDocMemberName(name);
}
}
else if (isTypeReferenceIdentifier(name as EntityName)) {
else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
const meaning = name.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace;
const symbol = resolveEntityName(name as EntityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name as EntityName);
const symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name);
}
if (name.parent.kind === SyntaxKind.TypePredicate) {
return resolveEntityName(name as Identifier, /*meaning*/ SymbolFlags.FunctionScopedVariable);
}
return undefined;
}

View File

@ -0,0 +1,13 @@
/// <reference path="fourslash.ts" />
// @target: esnext
//// class Foo {
//// #prop: string = "";
////
//// method() {
//// const test: Foo.#prop/*1*/ = "";
//// }
//// }
verify.quickInfoAt("1", "");