From db8a755938664344fdea9a05253451dd20d714a4 Mon Sep 17 00:00:00 2001 From: danusha2345 Date: Thu, 24 Sep 2026 19:09:25 +0300 Subject: [PATCH 1/2] fix(resolution): resolve TS/JS calls on a `new C()` receiver through C MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `new RegExp(p).exec(s)`, `new Array(n).fill(x)`, `new TextDecoder().decode(b)` reached the resolver as the bare method name and exact-matched any project method of that name (in codegraph's own index `new RegExp().exec` onto `SqliteDatabase::exec`, `new Array().fill` onto `TextOptions::fill`). Extraction (mirrored in the kernel) now keeps the constructed class: `new C(args).m()` is encoded `new C().m` (a member-chain constructor keeps its path, `new ns.C().m`); a constructor that is not a plain name or member chain emits nothing. The resolver resolves that shape only on C — through a named import alias to the declared name, and on a supertype in the conformance pass when C is a project class — so a built-in or external class yields no edge. A JS built-in name counts as a project class only when the file imports or declares it. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + __tests__/expression-receiver-calls.test.ts | 2 +- __tests__/fixtures/kernel-parity/torture.js | 3 + __tests__/kernel-tsjs-parity.test.ts | 5 +- __tests__/new-expression-receiver.test.ts | 106 ++++++++++++++++++++ codegraph-kernel/src/tsjs/extractors.rs | 19 +++- src/extraction/tree-sitter.ts | 23 ++++- src/resolution/index.ts | 16 ++- src/resolution/name-matcher.ts | 48 +++++++++ 9 files changed, 210 insertions(+), 13 deletions(-) create mode 100644 __tests__/new-expression-receiver.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index a984c54d79..ddf2ed32f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,6 +120,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - In JavaScript and TypeScript, a default import now links to what the module's `export default` statement exports, wherever the statement sits in the file. Before, a module that declares its default, like `export default function Vans() {…}` or `export default class Store {…}`, had its default import linked to the first function it exports instead: in a React Router data-router app, where a page exports its `loader` or `action` above the page component, `import Vans, { loader as vansLoader } from './pages/Vans'` made the route `/vans` and every use of `Vans` lead to the loader. A component file that also exports a styled or memoized component no longer hands its default import to that component, and an anonymous default, like `export default function () {…}` or `export default () => …`, is no longer linked to a function exported beside it or nested inside it. A module loaded with `require('./x').default` is read the same way. Re-index JavaScript and TypeScript projects after upgrading. - In React and Vue, a tag for a component the file imports from a package, like `