Skip to content

Commit

Permalink
Fixed crash when resolving a symbol on invalid private identifier in …
Browse files Browse the repository at this point in the history
…type reference (#60013)
  • Loading branch information
Andarist authored Sep 24, 2024
1 parent aa9df4d commit e962037
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference path="fourslash.ts" />

// @target: esnext

//// class Foo {
//// #prop: string = "";
////
//// method() {
//// const test: Foo.#prop/*1*/ = "";
//// }
//// }

verify.quickInfoAt("1", "");

0 comments on commit e962037

Please sign in to comment.