mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-24 03:08:45 +08:00
Scala extraction produced symbol nodes but almost no edges for typeclass-style
code: every supertype/type/implicit relationship was dropped, so a trait used as
a type, extended with type parameters, or required as an implicit looked like
nothing depended on it — on cats/algebra that was most of the graph.
- extends/with: `extends A[X] with B with C` packs all supertypes into one
`extends_clause`; the generic path took only namedChild(0) and kept the full
text (`A[X]`) so parameterized supertypes (every typeclass) never matched.
Iterate every supertype and unwrap `generic_type` → base type name via a new
shared `scalaBaseTypeName` helper.
- type references: add `scala` to the type-annotation languages so method
parameter/return types link; walk EVERY curried parameter list (the trailing
`(implicit M: TC[A])` list is where instances are passed); walk
`type_parameters` for context bounds (`def f[A: Monoid]`); and emit refs for
`val`/`var` type annotations from the Scala extractor. Capitalized Scala
primitives are skipped to avoid resolution noise.
- instantiation: `new T[...] { ... }` (`instance_expression`) now emits an
`instantiates` edge to the base type.
Measured (fair cross-file dependent coverage, symbol-bearing source files):
cats 48.9% → 89.2% (scalafix tooling + JMH benches excluded; 82.1% raw),
gatling 76.3% → 91.2%. Node count stable (edges added, not nodes); residual is
genuine frontiers (cross-build scala-2.12/2.13+/3 variants, laws test-support,
wildcard-import barrels, infix-type evidence). Full suite green; changes gated
to Scala so no cross-language regression.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>