fix(js-semantic): register ambient signature scopes#9476
Conversation
🦋 Changeset detectedLatest commit: d89bfbb The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughThis change registers three TypeScript class-member signature node kinds (TS_CONSTRUCTOR_SIGNATURE_CLASS_MEMBER, TS_GETTER_SIGNATURE_CLASS_MEMBER, TS_SETTER_SIGNATURE_CLASS_MEMBER) as scope-bound in the semantic model builder to avoid a panic during semantic analysis of ambient modules that reference local type aliases. A regression test exercises an ambient module with a type alias and class signatures and asserts scope-node mapping completeness. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.Change the |
|
this looks related to #9475 that repro includes an abstract getter signature in a class ( i have not minimized #9475 separately yet, so i cannot claim full coverage, but this change is a plausible fix or at least part of it |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.changeset/fix-ambient-module-signature-panic.md (1)
1-5: Minor: Consider linking to an issue if one exists.The changeset is well-written for end users. If there's an associated GitHub issue for this panic, the coding guidelines suggest using the format
Fixed [#NUMBER](issue link): ...for bug fix changesets. If no issue exists, this is fine as-is.As per coding guidelines: "For bug fix changesets, start with 'Fixed [
#NUMBER](issue link): ...' format"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/fix-ambient-module-signature-panic.md around lines 1 - 5, The changeset message should use the bug-fix format required by guidelines: update the opening sentence of .changeset/fix-ambient-module-signature-panic.md so it begins with "Fixed [`#NUMBER`](https://github.com/OWNER/REPO/issues/NUMBER):" followed by the existing description (e.g., "Fixed [`#1234`](link): Fixed a panic when Biome analyzed ambient TypeScript modules containing class constructor, getter, or setter signatures that reference local type aliases..."); if there is no issue, explicitly state that no issue exists and leave as-is per guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/fix-ambient-module-signature-panic.md:
- Around line 1-5: The changeset message should use the bug-fix format required
by guidelines: update the opening sentence of
.changeset/fix-ambient-module-signature-panic.md so it begins with "Fixed
[`#NUMBER`](https://github.com/OWNER/REPO/issues/NUMBER):" followed by the
existing description (e.g., "Fixed [`#1234`](link): Fixed a panic when Biome
analyzed ambient TypeScript modules containing class constructor, getter, or
setter signatures that reference local type aliases..."); if there is no issue,
explicitly state that no issue exists and leave as-is per guidelines.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4ab52783-35d3-4eba-b775-dfd58e5e043d
📒 Files selected for processing (3)
.changeset/fix-ambient-module-signature-panic.mdcrates/biome_js_semantic/src/semantic_model/builder.rscrates/biome_js_semantic/src/semantic_model/tests.rs
8994596 to
33cebf2
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
|
@masterkain I can't merge this PR due to conflicts |
|
mm can you please check if I missed |
Summary
This registers ambient class constructor/getter/setter signature scopes in the semantic model builder so
scope_node_by_rangestays in sync with the scope events emitted for TypeScript ambient declarations.It fixes a panic when Biome analyzes ambient modules like
declare module "jsoneditor" { ... }where a class signature references a local type alias.Test Plan
cargo test -p biome_js_semanticcargo test -p biome_js_semantic ok_semantic_model_ambient_module_type_alias_and_class -- --nocapturecargo clippy -p biome_js_semantic --lib --tests -- -D warningsjust formatDocs