fix(extract): emit inherits edge for JavaScript class extends - #1790
Open
Synvoya wants to merge 1 commit into
Open
fix(extract): emit inherits edge for JavaScript class extends#1790Synvoya wants to merge 1 commit into
Synvoya wants to merge 1 commit into
Conversation
Synvoya
force-pushed
the
fix/js-class-extends-inherits
branch
3 times, most recently
from
July 27, 2026 02:41
7e98bde to
e8c3461
Compare
Contributor
Author
|
Follow-up audit against current v8 found that JavaScript member-expression parents such as class Dog extends ns.Animal were still dropped. The branch now handles that AST shape and adds a regression test. Current validation: tests/test_ts_inheritance.py 9 passed; Ruff and git diff --check passed. |
Synvoya
force-pushed
the
fix/js-class-extends-inherits
branch
from
July 27, 2026 04:15
e8c3461 to
da59be9
Compare
Contributor
Author
|
Precision follow-up: I removed the member-expression tail normalization mentioned in my previous comment. Treating ns.Animal as bare Animal can falsely bind an unrelated same-file class without namespace-aware resolution. The final branch stays focused on direct JavaScript heritage identifiers, adds imported-class coverage and a runtime-expression negative control, and is squashed to one commit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Plain JavaScript class heritage was dropped:
class Dog extends Animal {}emitted noinheritsedge, while the equivalent TypeScript did.Root cause
The JavaScript grammar stores
extendsand its identifier directly underclass_heritage. TypeScript wraps the base in anextends_clause. The walker only handled the wrapped shape.Fix
When a
class_heritagenode has noextends_clauseorimplements_clause, treat the heritage node itself as the JavaScript extends clause. The guard preserves the existing TypeScript path and prevents duplicate edges.The implementation remains precision-first: direct same-file and imported identifiers resolve; runtime expressions such as
extends mixin(Animal)are not converted into fabricated static inheritance. Qualified member expressions require namespace-aware resolution and remain outside this focused fix.Validation
tests/test_ts_inheritance.py: 10 passed.git diff --check: passed.