Deferred from PR #1102 review.
Original reviewer comment: #1102 (comment)
Context:
Greptile flagged that the R extractor's handle_set_generic function is invoked for both setGeneric and setMethod, producing two function definition nodes for the same generic name in idiomatic S4 code:
setGeneric("greet", function(x) standardGeneric("greet"))
setMethod("greet", "Person", function(x) ...)
Both engines (native Rust and WASM/JS) have this behavior — src/extractors/r.ts shares the same single handler for both. Fixing in only one engine would create a parity gap.
Proposed fix:
setGeneric continues to emit a function definition node.
setMethod either:
- emits a
call edge to the generic instead of a new definition, or
- emits a definition node with a different kind (e.g.
method) so the resolver can dedupe by (name, kind).
Must be applied to both src/extractors/r.ts and crates/codegraph-core/src/extractors/r_lang.rs simultaneously to preserve engine parity (per CLAUDE.md rule).
Deferred from PR #1102 review.
Original reviewer comment: #1102 (comment)
Context:
Greptile flagged that the R extractor's
handle_set_genericfunction is invoked for bothsetGenericandsetMethod, producing twofunctiondefinition nodes for the same generic name in idiomatic S4 code:Both engines (native Rust and WASM/JS) have this behavior —
src/extractors/r.tsshares the same single handler for both. Fixing in only one engine would create a parity gap.Proposed fix:
setGenericcontinues to emit afunctiondefinition node.setMethodeither:calledge to the generic instead of a new definition, ormethod) so the resolver can dedupe by (name, kind).Must be applied to both
src/extractors/r.tsandcrates/codegraph-core/src/extractors/r_lang.rssimultaneously to preserve engine parity (per CLAUDE.md rule).