@@ -297,6 +297,23 @@ static const RFile kTsImport[] = {
297297 "function caller(v: number): number { return helper(v); }\n" },
298298};
299299
300+ /* An imported class constructed through an inferred local variable must retain
301+ * the imported class QN for subsequent member dispatch. The explicit type
302+ * annotation path already covers this shape; this fixture isolates inference.
303+ */
304+ static const RFile kTsInferredImportedMethod [] = {
305+ {"store.ts" ,
306+ "export class WidgetStore {\n"
307+ " findById(id: string): string { return id; }\n"
308+ "}\n" },
309+ {"service.ts" ,
310+ "import { WidgetStore } from \"./store\";\n"
311+ "function load(id: string): string {\n"
312+ " const store = new WidgetStore();\n"
313+ " return store.findById(id);\n"
314+ "}\n" },
315+ };
316+
300317/* lsp_ts_jsx — <Comp/> JSX element whose tag is a module-local component
301318 * function (ts_lsp.c:2643-2647). TSX only (jsx_mode); the tag's first letter is
302319 * uppercase so it is NOT treated as an intrinsic HTML element; it resolves via
@@ -370,6 +387,14 @@ TEST(repro_lsp_ts_import) {
370387 "lsp_ts_import" );
371388}
372389
390+ TEST (repro_lsp_ts_inferred_import_receiver ) {
391+ return assert_lsp_strategy_files (
392+ kTsInferredImportedMethod ,
393+ (int )(sizeof (kTsInferredImportedMethod ) /
394+ sizeof (kTsInferredImportedMethod [0 ])),
395+ "lsp_ts_method" );
396+ }
397+
373398TEST (repro_lsp_ts_jsx ) {
374399 return assert_lsp_strategy ("app.tsx" , kTsxJsx , "lsp_ts_jsx" );
375400}
@@ -403,6 +428,7 @@ SUITE(repro_lsp_ts) {
403428 RUN_TEST (repro_lsp_ts_method );
404429 RUN_TEST (repro_lsp_ts_namespace );
405430 RUN_TEST (repro_lsp_ts_import );
431+ RUN_TEST (repro_lsp_ts_inferred_import_receiver );
406432 RUN_TEST (repro_lsp_ts_jsx );
407433 RUN_TEST (repro_lsp_ts_jsx_import );
408434 RUN_TEST (repro_lsp_ts_default );
0 commit comments