Skip to content

fix: cross-language refs, TSX JSX-prop indexing, Swift field refs, TS export signatures#55

Merged
1broseidon merged 2 commits into
mainfrom
fix/macos-defects-investigate-tsx-swift-ts
May 9, 2026
Merged

fix: cross-language refs, TSX JSX-prop indexing, Swift field refs, TS export signatures#55
1broseidon merged 2 commits into
mainfrom
fix/macos-defects-investigate-tsx-swift-ts

Conversation

@1broseidon

Copy link
Copy Markdown
Owner

Summary

Five defects surfaced by an external smoke test on real Swift / TSX / Go projects. None caught by the bench corpus because it has no Swift, no TSX with JSX-prop async fns, and no polyglot same-name symbols.

Defects fixed

Defect Fix
cymbal investigate cross-pollutes refs across same-named symbols (Go App struct returned TSX App() callsites) Added FindReferencesScoped/FindImpactScoped in index/store.go; Investigate/InvestigateResolved pass sym.Language. cymbal refs keeps documented best-effort name-only behavior.
TSX JSX-prop arrow fns indexed as method async (async keyword harvested as symbol name) Split .tsx into its own language entry using tree-sitter-typescript's LanguageTSX(); route tsx through the JS classifier / refs / implements dispatch. .ts / .mts / .cts still use the plain TypeScript grammar.
Swift field/property refs returned zero Added navigation_expression handling in extractRefSwift — captures the receiver when parent is a call_expression, the trailing member otherwise.
TypeScript export function declarations missing signature New jsSignatureNode descends export_statement / lexical_declaration wrappers before parameter/return-type extraction. Also fixes export const fn = (x) => … arrow forms.
Swift @MainActor / modifier absorbed into protocol/class range New swiftKeywordAnchor in nodeToSymbol anchors swift declarations to the keyword node, skipping leading attributes/modifiers.

The Go same-name method-receiver collision the report also flagged is documented as best-effort and is left as-is.

Verification

  • go test ./... — all green.
  • go run ./bench check — PASS, no regressions vs the 2026-04-15 baseline.
  • Bench accuracy phases stay at 100% (85/85, 61/61, 10/10, 7/7).
  • Repro fixtures under /tmp/cymbal-defect-repro/{polyglot,swift,ts-export} confirm each defect goes from broken → fixed end-to-end.

Files

  • index/store.goFindReferencesScoped, FindImpactScoped
  • index/index.goInvestigate/InvestigateResolved pass language
  • index/index_phase3_test.goTestInvestigateScopesRefsByLanguage
  • lang/registry.go — split tsx language using LanguageTSX()
  • lang/lang_test.go, walker/walker_feature_test.go — updated tsx mapping
  • parser/parser.go — JS dispatch routes tsx; jsSignatureNode, swiftKeywordAnchor, swiftNavigationRef
  • parser/parser_feature_test.go — TSX, TS export signature, Swift field-ref, Swift attributed-protocol regressions
  • CHANGELOG.md — Unreleased entries

Test plan

  • go test ./...
  • go run ./bench check
  • Manual repro of each defect on minimal fixtures pre/post fix

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 77.93103% with 32 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
index/store.go 56.66% 26 Missing ⚠️
parser/parser.go 94.80% 4 Missing ⚠️
index/index.go 75.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

1broseidon and others added 2 commits May 8, 2026 21:23
… export signatures

Five defects surfaced by an external smoke test on real Swift / TSX / Go
projects. None caught by the bench corpus because it has no Swift, no TSX
with JSX-prop async fns, and no polyglot same-name symbols.

- Investigate cross-pollution: `cymbal investigate` resolves to a single
  symbol but FindReferences/FindImpact were name-only, so e.g. a Go struct
  named App leaked refs from a TSX function with the same name. Added
  FindReferencesScoped / FindImpactScoped that filter by language; wired
  Investigate / InvestigateResolved to pass the resolved symbol's language.
  `cymbal refs` keeps documented best-effort name-only behavior.

- TSX JSX-prop arrow fns indexed as `method async`: .tsx files were parsed
  with the plain typescript grammar, which can't see JSX boundaries. Split
  tsx into its own language entry using tree-sitter-typescript's TSX
  grammar; route `tsx` through the JS classifier / refs / implements
  dispatch.

- Swift field/property refs returned 0: extractRefSwift only handled
  call_expression and user_type, missing navigation_expression. Added
  navigation handling that captures the receiver when parent is a call,
  and the trailing member otherwise — so `self.field`, `field.method()`,
  and `self.a.b = x` all record refs.

- TS export-function signatures missing: classifyJS attaches the outer
  export_statement / lexical_declaration node to the symbol, so signature
  extraction looked for parameters on the wrapper. Added jsSignatureNode
  to descend through wrappers before parameter / return-type extraction.

- Swift @mainactor decorator absorbed into protocol range: protocol_decl
  start_line included leading attributes. Added swiftKeywordAnchor to
  anchor swift symbol ranges to the keyword node (protocol/class/func/etc).

bench check passes against the 2026-04-15 baseline; accuracy phases stay
at 100% across all corpora.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@1broseidon 1broseidon force-pushed the fix/macos-defects-investigate-tsx-swift-ts branch from d75273c to 00f7f6d Compare May 9, 2026 02:23
@1broseidon 1broseidon merged commit 6bcedc5 into main May 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants