Skip to content

Commit e962037

Browse files
authored
Fixed crash when resolving a symbol on invalid private identifier in type reference (#60013)
1 parent aa9df4d commit e962037

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49143,15 +49143,14 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4914349143
return resolveJSDocMemberName(name);
4914449144
}
4914549145
}
49146-
else if (isTypeReferenceIdentifier(name as EntityName)) {
49146+
else if (isEntityName(name) && isTypeReferenceIdentifier(name)) {
4914749147
const meaning = name.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace;
49148-
const symbol = resolveEntityName(name as EntityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
49149-
return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name as EntityName);
49148+
const symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
49149+
return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name);
4915049150
}
4915149151
if (name.parent.kind === SyntaxKind.TypePredicate) {
4915249152
return resolveEntityName(name as Identifier, /*meaning*/ SymbolFlags.FunctionScopedVariable);
4915349153
}
49154-
4915549154
return undefined;
4915649155
}
4915749156

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @target: esnext
4+
5+
//// class Foo {
6+
//// #prop: string = "";
7+
////
8+
//// method() {
9+
//// const test: Foo.#prop/*1*/ = "";
10+
//// }
11+
//// }
12+
13+
verify.quickInfoAt("1", "");

0 commit comments

Comments
 (0)