Skip to content

Distinguish JavaScript and TypeScript accessors#289

Closed
Iron-Ham wants to merge 1 commit into
Ataraxy-Labs:mainfrom
Iron-Ham:Iron-Ham/fix-ts-accessor-entities
Closed

Distinguish JavaScript and TypeScript accessors#289
Iron-Ham wants to merge 1 commit into
Ataraxy-Labs:mainfrom
Iron-Ham:Iron-Ham/fix-ts-accessor-entities

Conversation

@Iron-Ham
Copy link
Copy Markdown
Contributor

@Iron-Ham Iron-Ham commented Jun 1, 2026

Closes #267

Summary

  • classify JavaScript/TypeScript class accessors as getter/setter entities instead of generic methods
  • allow context and impact lookups to use type-qualified entity queries such as getter value and setter value
  • add parser and CLI regression coverage for TypeScript, TSX, and JavaScript accessors

Test plan

  • cargo test -p sem-core --no-fail-fast
  • cargo test -p sem-cli --no-fail-fast
  • validated the rebuilt target/debug/sem in temporary git repos for entities, diff, context, and impact accessor behavior

Review

  • independent subagent review completed; requested missing tests were added
  • claude -p review was launched twice, but the CLI produced no output and timed out on the bounded retry

Copy link
Copy Markdown

@inspect-review inspect-review Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inspect review

Triage: 18 entities analyzed | 0 critical, 0 high, 5 medium, 13 low
Verdict: standard_review

Findings (2)

  1. [low] In map_js_ts_accessor_method_type, the function returns None for non-JS/TS languages, but the caller in map_entity_type uses unwrap_or_else(|| map_node_type(node.kind())) which will call map_node_type for all non-accessor method_definitions in JS/TS. This means regular methods in JS/TS will be mapped twice - once through the None path and once through the fallback, potentially causing incorrect entity types.
  2. [low] In split_type_qualified_query, the function splits on the first space and checks if both parts are non-empty, but it doesn't validate that entity_type is a valid entity type. This means queries like 'invalid_type value' will pass validation and match entities with entity_type='invalid_type', which may not exist, leading to confusing behavior where queries appear valid but never match.

Reviewed by inspect | Entity-level triage found 0 high-risk changes

@Iron-Ham Iron-Ham marked this pull request as ready for review June 1, 2026 23:59
@Iron-Ham
Copy link
Copy Markdown
Contributor Author

Iron-Ham commented Jun 2, 2026

Superseded by #309.

@Iron-Ham Iron-Ham closed this Jun 2, 2026
rs545837 pushed a commit that referenced this pull request Jun 5, 2026
## Summary
- consolidate the open TypeScript/JavaScript parser, extraction,
accessor, namespace, abstract entity, and import-resolution fixes
- keep the combined graph/scope behavior from the parent PRs in one
reviewable branch

Supersedes #303, #305, #291, #289, #288, #285.
Fixes #264.
Fixes #262.
Fixes #265.
Closes #267.
Fixes #266.
Fixes #263.

## Test plan
- cargo test --manifest-path crates/Cargo.toml -p sem-core typescript
- cargo test --manifest-path crates/Cargo.toml -p sem-core js_ts
- cargo test --manifest-path crates/Cargo.toml -p sem-core
import_resolution
- cargo test --manifest-path crates/Cargo.toml -p sem-core
scope_resolve_typescript
- cargo test --manifest-path crates/Cargo.toml -p sem-cli --test
accessor_cli
- cargo check --manifest-path crates/Cargo.toml -p sem-core -p sem-cli
- cargo test --manifest-path crates/Cargo.toml -p sem-core graph
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.

TypeScript getter and setter accessors are indistinguishable (both emit as method <name>)

1 participant