Skip to content

fix(parser): close symbol-extraction gaps across 8 languages#520

Merged
coseto6125 merged 3 commits into
mainfrom
fix/parser-symbol-gaps-14lang
May 31, 2026
Merged

fix(parser): close symbol-extraction gaps across 8 languages#520
coseto6125 merged 3 commits into
mainfrom
fix/parser-symbol-gaps-14lang

Conversation

@coseto6125
Copy link
Copy Markdown
Owner

@coseto6125 coseto6125 commented May 30, 2026

Closes the bulk of FU-2026-05-29-001 (symbol-parse completeness audit).

Each language adds the previously-missing capture so the graph stops dropping real nodes/edges that ecp impact/find depend on. One dedicated test bin per language (happy path + regression):

Lang Gap closed Filter
Java record_declaration → Class + components → Property A/B
PHP in-class use Trait; → class→trait heritage edge A
C# operator / conversion-operator / event / event-field / indexer / destructor → Method (body-calls attach via enclosing_containers) A
Rust extern "C" foreign_mod function_signature_item captured B
Swift protocol_property_declaration captured B
Kotlin type_alias → Typedef; companion-object methods → Method B/C
Python X: TypeAlias = … (PEP 613) → Typedef, not Variable C
C++ constexpr/const globals → Const, not Variable C

Ruby: already fixed → regression test only

The FU listed class << self methods as a kind-bug ("instance Method, should be class-level"). Investigation (direct probe of the is_static flag) shows the bug was already fixed: function_meta::ruby sets FLAG_STATIC for both class-level forms — def self.foo (singleton_method) directly, and methods nested under singleton_class (class << self) via a parent().parent() == singleton_class walk. The FU entry was stale.

What was missing is a regression test, so this PR adds ruby_singleton_static.rs pinning: both class-level forms are is_static, instance methods are not. The parent-chain walk in ruby.rs:53-58 is the fragile part the test guards. (FU entry to be marked resolved in the separate chore/followups-* PR.)

Verification

  • 8 new gap test bins + Ruby pin test green (C#7 / Java6 / PHP6 / Rust2 / Swift6 / Kotlin2 / Python5 / C++7 / Ruby5).
  • Full regression suites for the deeply-changed langs (python / csharp / kotlin parser+spec+query) pass, 0 failures.
  • clippy -p ecp-analyzer --tests clean.

Per CLAUDE.md, the per-lang queries.scm additions map to existing NodeKinds and do not touch shared primitives, so the 14-lang-parity rule does not gate them; coverage is per-affected-language instead.

Adds previously-missing symbol captures so the graph stops dropping real
nodes/edges that `ecp impact`/`find` rely on. Each language ships a
dedicated test bin (happy path + regression):

- Java:   record_declaration -> Class + components -> Property
- PHP:    in-class `use Trait;` -> class->trait heritage edge
- C#:     operator/conversion-operator/event/event-field/indexer/destructor
          -> Method nodes so body-calls attach via enclosing_containers
- Rust:   `extern "C"` foreign_mod function_signature_item captured
- Swift:  protocol_property_declaration captured
- Kotlin: type_alias -> Typedef; companion-object methods -> Method
- Python: `X: TypeAlias = ...` (PEP 613) -> Typedef, not Variable
- C++:    constexpr/const globals -> Const, not Variable

Ruby (`class << self`) was investigated and is a verified no-op: the
schema has no class-vs-instance method distinction (`RawNode` carries no
is_static flag), so `def self.foo` and `class << self; def foo` already
produce byte-identical output (Method, owner=EnclosingClass). Promoting
the distinction would be a schema-append with no impact/find benefit, so
it is intentionally left unchanged.

All touched-language regression suites pass (python/csharp/kotlin full
bins, 0 failures); clippy clean on ecp-analyzer.
@coseto6125 coseto6125 enabled auto-merge (squash) May 30, 2026 23:37
@coseto6125 coseto6125 added the merge-queue Opt-in to Mergify merge queue label May 30, 2026
The FU-2026-05-29-001 entry flagged Ruby `class << self` methods as
producing instance Methods (missing class-level marking). Investigation
shows `function_meta::ruby` already sets FLAG_STATIC for both forms —
`singleton_method` (`def self.foo`) directly, and methods nested under
`singleton_class` (`class << self`) via a parent().parent() walk. The
bug was already fixed; what was missing is a regression test.

This pins the behaviour: both class-level forms are is_static, instance
methods are not. The parent-chain walk in ruby.rs:53-58 is the fragile
part — this test fails loudly if a grammar-handling change breaks it.
simplify pass findings:
- destructor.name / event_field.name were resolved via
  capture_index_for_name inside parse_file (once per file, 50k string
  scans over a 25k-file index). Moved into CSharpCaptureIndices, resolved
  once at construction like every other index the struct documents.
- canonical_name was built and cloned outside or_insert_with, allocating
  a String on every match including dedup hits that never insert. Moved
  the name construction into the closure so it allocates only on actual
  node insertion.
@github-actions
Copy link
Copy Markdown
Contributor

ecp impact cache (0 symbols) — internal, used by ecp dev pr-analyze

[]

@github-actions github-actions Bot added the ecp:risk-low ecp signal label May 30, 2026
@coseto6125 coseto6125 merged commit 4b3e51a into main May 31, 2026
18 checks passed
@coseto6125 coseto6125 deleted the fix/parser-symbol-gaps-14lang branch May 31, 2026 00:03
coseto6125 added a commit that referenced this pull request May 31, 2026
The v0.6.2 section was generated by the release-PR (#524) bump before
#523/#525/#526 merged, so it listed only #520/#521/#522. Backfill the
three before tagging v0.6.2 so the release notes match what the tag
actually ships:
- #525 field-reassign collision fix (Bug Fixes)
- #523 cypher prop-filter refactor (Refactor)
- #526 `--file` flag rename (Chore)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecp:risk-low ecp signal merge-queue Opt-in to Mergify merge queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant