fix(ts): resolve inferred imported constructor receivers - #1999
fix(ts): resolve inferred imported constructor receivers#1999mikemikimike wants to merge 2 commits into
Conversation
Signed-off-by: mikemikimike <13286568797@163.com>
|
This is a good fix, and it does more than your title claims — in the right direction. I would like a test for the part you did not mention. The mechanism is the right oneRouting a bare constructor name through The guard is what makes it safe, and it is worth saying why, because it is the part a reviewer would otherwise have to derive: if (bound && bound->kind == CBM_TYPE_NAMED && bound->data.named.qualified_name)
The part you did not claim
Before this change, That is a broader improvement than the imported-class case, and it is likely to move TypeScript Please add one more fixture in the same shape as the one you wrote — an inferred One shape it can still get wrongScope lookup precedes imports in Your lint note
That is a known false positive, not drift you caused. Our Thanks also for the explicit AI-assistance note and for the reproduce-first fixture — both make this quicker to review honestly. Add the stdlib test and the description line and I am happy with this. |
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
Signed-off-by: mikemikimike <13286568797@163.com>
What does this PR do?
Fixes #1974.
When TypeScript infers a local variable from
new Foo(), resolve the constructor through the existing lexical/import type lookup before falling back to the current module. This preserves the imported class qualified name, so calls such asstore.findById()produce the expectedCALLSedge without changing explicitly annotated locals.The same lookup also preserves the bare qualified names registered for TypeScript standard-library classes. Inferred
new Map<string, string>()locals can therefore dispatchm.get(id)to the registeredMap.getmethod instead of falling back to weak name-only resolution.Validation
ASAN_OPTIONS=detect_leaks=0 make -f Makefile.cbm test— passed.ASAN_OPTIONS=detect_leaks=0 make -f Makefile.cbm test-focused TEST_SUITES=ts_lsp— passed (303 tests, including the inferred-stdlib receiver regression).cppcheck— passed.git diff --check— passed.scripts/lint.sh --ci— blocked by pre-existing clang-format violations insrc/mcp/mcp.c,src/pipeline/pipeline_incremental.c, andsrc/cli/cli.c; no violation was reported for the changed implementation file.make -f Makefile.cbm security— static, binary-string, and UI audits passed; the existing robustness suite reported 26/32 due to input timeouts, and install/network checks are environment-limited in WSL.Checklist
git commit -s).AI assistance
This change was prepared with AI assistance. The implementation, regression fixtures, and local validation should be reviewed by maintainers.