From 40fca3d24f425378a031b4cc7aed5794ee51fb44 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 Mar 2023 13:28:07 -0700 Subject: [PATCH 1/3] create test with repro --- tests/cases/fourslash/classSymbolLookup.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/cases/fourslash/classSymbolLookup.ts diff --git a/tests/cases/fourslash/classSymbolLookup.ts b/tests/cases/fourslash/classSymbolLookup.ts new file mode 100644 index 0000000000000..7e679b4e3535b --- /dev/null +++ b/tests/cases/fourslash/classSymbolLookup.ts @@ -0,0 +1,20 @@ +/// + +// Issue #53247 + +//// class Foo { +//// private constructor(value : T, context: C){ } + +//// static readonly makeFoo = (context : C) => +//// (value : T) => +//// new Foo(value, context); +//// } + +//// const x = Foo.makeFoo<{}>; //// Cannot find name 'Foo'.ts(2304) +//// //// 'Foo' only refers to a type, but +//// //// is being used as a namespace here.ts(2702) + +//// x({}); // 👍 `const x: <{}>(context: {}) => (value: T) => Foo` + +verify.encodedSemanticClassificationsLength("2020", 75); +verify.getSemanticDiagnostics([]); \ No newline at end of file From ed815a1b38db94616d6b226c8c2014673a13e15a Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 Mar 2023 14:11:57 -0700 Subject: [PATCH 2/3] ignoreErrors in resolve entity because it might fail --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 825d339cfd3bd..484bb049e46c5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -45308,7 +45308,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } meaning |= SymbolFlags.Alias; - const entityNameSymbol = isEntityNameExpression(name) ? resolveEntityName(name, meaning) : undefined; + const entityNameSymbol = isEntityNameExpression(name) ? resolveEntityName(name, meaning, /*ignoreErrors*/ true) : undefined; if (entityNameSymbol) { return entityNameSymbol; } From 6c1bbaaf9e80268706ec19c0c2961895b23b89e2 Mon Sep 17 00:00:00 2001 From: Gabriela Araujo Britto Date: Wed, 22 Mar 2023 15:06:04 -0700 Subject: [PATCH 3/3] remove comments from test --- tests/cases/fourslash/classSymbolLookup.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/cases/fourslash/classSymbolLookup.ts b/tests/cases/fourslash/classSymbolLookup.ts index 7e679b4e3535b..fca63b6174c6a 100644 --- a/tests/cases/fourslash/classSymbolLookup.ts +++ b/tests/cases/fourslash/classSymbolLookup.ts @@ -4,17 +4,12 @@ //// class Foo { //// private constructor(value : T, context: C){ } - //// static readonly makeFoo = (context : C) => //// (value : T) => //// new Foo(value, context); //// } - -//// const x = Foo.makeFoo<{}>; //// Cannot find name 'Foo'.ts(2304) -//// //// 'Foo' only refers to a type, but -//// //// is being used as a namespace here.ts(2702) - -//// x({}); // 👍 `const x: <{}>(context: {}) => (value: T) => Foo` +//// const x = Foo.makeFoo<{}>; +//// x({}); verify.encodedSemanticClassificationsLength("2020", 75); verify.getSemanticDiagnostics([]); \ No newline at end of file