fix(groovy): emit inherits/implements edges for extends/implements#1534
Closed
Synvoya wants to merge 1 commit into
Closed
fix(groovy): emit inherits/implements edges for extends/implements#1534Synvoya wants to merge 1 commit into
Synvoya wants to merge 1 commit into
Conversation
tree-sitter-groovy exposes inheritance via the same `superclass` and `interfaces`/`type_list` fields as tree-sitter-java, but the inheritance- emitting block in `_extract_generic` was gated on `ts_module == "tree_sitter_java"`. Groovy was the only class-based JVM language in the file with no inheritance handler, so every Groovy `extends`/`implements` was silently dropped (contains/methods/imports/calls were unaffected). Widen the gate to include `tree_sitter_groovy`; the existing `_emit_java_parent_type` path handles the identical node shapes verbatim. Adds a base class + interface to the Groovy fixture and two regression tests (extends -> inherits, implements -> implements). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Merged into |
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.
Summary
The Groovy extractor silently drops every
extendsandimplementsrelationship.contains, methods, imports, and calls all work — but class inheritance produces no edges.Root cause
tree-sitter-groovy exposes inheritance through the same grammar shape as tree-sitter-java:
But the inheritance-emitting block in
_extract_genericis gated onconfig.ts_module == "tree_sitter_java". Groovy (ts_module="tree_sitter_groovy") never enters it — it was the only class-based JVM language in the file without an inheritance handler (Java, Kotlin, Scala, C#, Swift, C++, PHP, Python all have one).Fix
Widen the gate to include
tree_sitter_groovy. The existing_emit_java_parent_type/_java_collect_type_refspath consumes the identical node shapes verbatim — no new handler needed.Verification
extends->inherits,implements->implements).pytest tests/test_languages.py-> 269 passed, 13 skipped (was 267 + my 2 new); Java inheritance tests unaffected (the shared path is reused, not changed).ruff check --config pyproject.toml-> clean.Before / after
class UserService extends Base implements Repo {}containsedgesinherits UserService->Base,implements UserService->Repo