-
-
Notifications
You must be signed in to change notification settings - Fork 794
chore: refactor global type system to accommodate further extensions #8253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: refactor global type system to accommodate further extensions #8253
Conversation
|
232b09d to
79f772d
Compare
CodSpeed Performance ReportMerging #8253 will not alter performanceComparing Summary
Footnotes
|
3ac9cd7 to
638c3b8
Compare
dyc3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, at a glance
| .collect() | ||
| }); | ||
|
|
||
| pub const UNKNOWN_ID: TypeId = TypeId::new(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IDs and type name strings are moved to global_ids.rs.
| TypeData::Conditional, | ||
| TypeData::Number, | ||
| TypeData::String, | ||
| let mut builder = GlobalsResolverBuilder::with_capacity(NUM_PREDEFINED_TYPES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main part of my PR. Basically, instead of initializing the vec with all the TypeData upfront, we just prefill it with None, and then fill it later with set_type_data. That way, we don't care about the order.
WalkthroughThis PR refactors predefined global-type initialization by adding a new GlobalsResolverBuilder and a new Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/biome_js_type_info/src/globals.rs (1)
336-383: FixMAP_CALLBACK_IDto match its declared generic signatureThe declaration in
globals_ids.rs:67states<U>(item: T) => U, but the implementation atglobals.rs:348–361currently omits theUtype parameter and usesGLOBAL_U_IDfor the parameter type instead ofGLOBAL_T_ID.Update lines 349–361 to:
TypeData::from(Function { is_async: false, type_parameters: [GLOBAL_U_ID.into()].into(), name: Some(Text::new_static(MAP_CALLBACK_ID_NAME)), parameters: [FunctionParameter::Pattern(PatternFunctionParameter { ty: GLOBAL_T_ID.into(), bindings: Default::default(), is_optional: false, is_rest: false, })] .into(), return_type: ReturnType::Type(GLOBAL_U_ID.into()), }),This aligns the implementation with the declared signature and ensures correct type inference for
Array<T>.map<U>(callback: (item: T) => U).
🧹 Nitpick comments (2)
.changeset/giant-shoes-hear.md (1)
1-5: Polish the changeset wording and spellingTo match the changeset guidelines, this should be past tense and fix the typo:
-chore: Refactor global type system to accomodate further extensions +chore: Refactored global type system to accommodate further extensionsIf you want to be extra nice to users, you could also mention that “Biome now makes it easier to extend global types (see #5977)”.
crates/biome_js_type_info/Cargo.toml (1)
25-25: Alignpastedependency with workspace conventionsIf
pasteis already declared in the workspace root, it’s better to wire this crate to the shared version:-paste = "1.0" +paste = { workspace = true }This keeps versions in lockstep across crates.
Please double‑check the root
Cargo.tomland adjust toworkspace = trueifpasteis indeed managed there.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lockand included by**
📒 Files selected for processing (8)
.changeset/giant-shoes-hear.md(1 hunks)crates/biome_js_type_info/Cargo.toml(1 hunks)crates/biome_js_type_info/src/format_type_info.rs(1 hunks)crates/biome_js_type_info/src/globals.rs(10 hunks)crates/biome_js_type_info/src/globals_builder.rs(1 hunks)crates/biome_js_type_info/src/globals_ids.rs(1 hunks)crates/biome_js_type_info/src/lib.rs(2 hunks)crates/biome_js_type_info/src/resolver.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/Cargo.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use workspace dependencies defined in the root
Cargo.tomlfor internal crates, specifyingworkspace = truein each crate's Cargo.toml. Use path dependencies for dev-dependencies to avoid requiring published versions.
Files:
crates/biome_js_type_info/Cargo.toml
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use the Rustdbg!()macro for debugging output during test execution, and pass the--show-outputflag tocargo testto display debug output.
Use snapshot testing with theinstacrate for testing in Rust projects. Accept or reject snapshots usingcargo insta accept,cargo insta reject, orcargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against thenextbranch of the website repository.
Set theversionmetadata field in linter rule implementations to'next'for newly created rules. Update this field to the new version number when releasing a minor or major version.
Files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
crates/biome_js_type_info/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)
crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind anArc
UseTypeReferenceinstead ofArcfor types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures withArcfor improved data locality and performance
UseTypeReferencevariants (Qualifier,Resolved,Import,Unknown) to represent different phases of type resolution
UseTypeData::Unknownto indicate when type inference falls short or is not implemented
Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types
When usingResolvedTypeData, track theResolverIdto ensure subsequent resolver calls use the correct context
Always apply the correctResolverIdwhen retrieving raw type data fromResolvedTypeData.as_raw_data()to prevent panics during subsequent resolution calls
Files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
**/.changeset/*.md
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.
Files:
.changeset/giant-shoes-hear.md
🧠 Learnings (23)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
📚 Learning: 2025-11-24T18:05:20.343Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.343Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:03:52.014Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.
Applied to files:
crates/biome_js_type_info/Cargo.toml.changeset/giant-shoes-hear.md
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/Cargo.toml : Use workspace dependencies defined in the root `Cargo.toml` for internal crates, specifying `workspace = true` in each crate's Cargo.toml. Use path dependencies for dev-dependencies to avoid requiring published versions.
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:06:03.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.536Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:06:03.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.536Z
Learning: Create two new crates `biome_{language}_syntax` and `biome_{language}_factory` using `cargo new --lib` for new language parsers
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : No module may copy or clone data from another module in the module graph, not even behind an `Arc`
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.017Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.017Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/resolver.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Ensure the type implementing Diagnostic derives Debug
Applied to files:
crates/biome_js_type_info/src/resolver.rs
📚 Learning: 2025-11-24T18:04:42.146Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.146Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ban functions or variables should use the semantic model to check if the variable is global before reporting, to avoid false positives on locally redeclared variables
Applied to files:
crates/biome_js_type_info/src/lib.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
Applied to files:
crates/biome_js_type_info/src/lib.rs
📚 Learning: 2025-09-09T18:10:05.095Z
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Applied to files:
crates/biome_js_type_info/src/lib.rscrates/biome_js_type_info/src/globals_ids.rscrates/biome_js_type_info/src/globals.rs
🧬 Code graph analysis (4)
crates/biome_js_type_info/src/format_type_info.rs (4)
crates/biome_js_type_info/src/resolver.rs (7)
name(502-504)id(71-73)resolved(742-742)resolved(749-795)resolved(803-817)new(54-56)new(293-298)crates/biome_js_type_info/src/type_data.rs (5)
name(951-953)name(999-1005)new(39-43)new(1436-1440)new(1471-1481)crates/biome_js_type_info/src/globals.rs (1)
global_type_name(47-96)crates/biome_js_type_info/src/type.rs (1)
id(74-76)
crates/biome_js_type_info/src/resolver.rs (1)
crates/biome_js_type_info/src/globals.rs (1)
global_type_name(47-96)
crates/biome_js_type_info/src/globals_ids.rs (1)
crates/biome_js_type_info/src/resolver.rs (2)
new(54-56)new(293-298)
crates/biome_js_type_info/src/globals.rs (1)
crates/biome_js_type_info/src/globals_builder.rs (2)
default(58-60)with_capacity(16-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: autofix
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_json_analyze)
🔇 Additional comments (5)
crates/biome_js_type_info/src/globals_ids.rs (1)
1-116: Global ID indices andNUM_PREDEFINED_TYPESlook consistentThe define_global_type! usage, ID values (0–43), and
NUM_PREDEFINED_TYPES: usize = 44line up correctly, and theGLOBAL_*aliases wrap them withGLOBAL_LEVELas expected. This should make further additions much less brittle.crates/biome_js_type_info/src/resolver.rs (1)
34-45: Debug formatting for globalResolvedTypeIdlooks goodUsing
global_type_namewhen available and then falling back to a stableGlobal TypeId(...)scheme for predefined vs later globals is a nice improvement for debuggability without changing semantics.crates/biome_js_type_info/src/lib.rs (1)
7-20: Module split betweenglobalsandglobals_idslooks sensibleMaking
globals_idspub(crate)and re‑exporting onlyGLOBAL_RESOLVER/GlobalsResolverplus the minimalGLOBAL_UNKNOWN_ID/NUM_PREDEFINED_TYPESpair keeps the external surface compact while giving the crate enough internal access to the new ID machinery.crates/biome_js_type_info/src/globals_builder.rs (1)
1-61: Builder invariants for globals are well enforcedThe one-shot
set_type_datacontract (bounds + “only set once” asserts) and the panic on unfilled slots inbuildgive nice protection against future refactors quietly forgetting to populate a predefined ID. Defaulting toNUM_PREDEFINED_TYPESkeeps it tied to the ID table.crates/biome_js_type_info/src/globals.rs (1)
20-43: Global members andglobal_type_namewiring look coherent
GLOBAL_TYPE_MEMBERSiterating from0..NUM_PREDEFINED_TYPESand usingglobal_type_name(id).unwrap_or("unknown")means every predefined ID has a deterministic, human‑readable member, and the match inglobal_type_namelines up with the IDs fromglobals_ids. This should make snapshot output and future codegen much easier to reason about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
crates/biome_js_type_info/src/format_type_info.rs (1)
591-607: Potential underflow ifglobal_type_namedoesn't cover all predefined IDsThe else branch at line 598 computes
id.index() - NUM_PREDEFINED_TYPES, assumingglobal_type_name(id)returningNoneimpliesid.index() >= NUM_PREDEFINED_TYPES. If any predefined type ID is missing from the match arms inglobal_type_name, this will underflow.The previous review suggested using the raw index for predefined types. Consider adding a guard or using the approach from the
Debugimpl inresolver.rs.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
crates/biome_js_type_info/src/format_type_info.rs(1 hunks)crates/biome_js_type_info/src/globals.rs(9 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use the Rustdbg!()macro for debugging output during test execution, and pass the--show-outputflag tocargo testto display debug output.
Use snapshot testing with theinstacrate for testing in Rust projects. Accept or reject snapshots usingcargo insta accept,cargo insta reject, orcargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against thenextbranch of the website repository.
Set theversionmetadata field in linter rule implementations to'next'for newly created rules. Update this field to the new version number when releasing a minor or major version.
Files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
crates/biome_js_type_info/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)
crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind anArc
UseTypeReferenceinstead ofArcfor types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures withArcfor improved data locality and performance
UseTypeReferencevariants (Qualifier,Resolved,Import,Unknown) to represent different phases of type resolution
UseTypeData::Unknownto indicate when type inference falls short or is not implemented
Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types
When usingResolvedTypeData, track theResolverIdto ensure subsequent resolver calls use the correct context
Always apply the correctResolverIdwhen retrieving raw type data fromResolvedTypeData.as_raw_data()to prevent panics during subsequent resolution calls
Files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_type_info/src/format_type_info.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-09-09T18:10:05.095Z
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Applied to files:
crates/biome_js_type_info/src/globals.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
- GitHub Check: Documentation
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: End-to-end tests
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: autofix
- GitHub Check: Bench (biome_tailwind_parser)
🔇 Additional comments (2)
crates/biome_js_type_info/src/globals.rs (2)
155-409: Builder pattern nicely decouples type registration from index orderingThe refactor to
GlobalsResolverBuilderwith explicitset_type_data(ID, TypeData)calls eliminates the fragile coupling between vector indices and type ID integers. This makes future additions (manual or generated) considerably less error-prone.
45-96: Name mapping looks complete for current predefined typesThe match arms cover all the predefined ID constants used in the builder below. The TODO for codegen is sensible—once implemented, this will stay in sync automatically.
| builder.set_type_data( | ||
| REGEXP_EXEC_ID, | ||
| TypeData::from(Function { | ||
| is_async: false, | ||
| type_parameters: Default::default(), | ||
| name: Some(Text::new_static(REGEXP_EXEC_ID_NAME)), | ||
| parameters: Default::default(), | ||
| return_type: ReturnType::Type(GLOBAL_INSTANCEOF_REGEXP_ID.into()), | ||
| }), | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RegExp.exec return type appears incorrect
RegExp.prototype.exec() returns RegExpExecArray | null, not a RegExp instance. Line 405 sets the return type to GLOBAL_INSTANCEOF_REGEXP_ID, which would indicate it returns a RegExp.
This is likely a copy-paste artefact. Consider introducing a proper return type (e.g., a union of a match array and null, or Unknown as a placeholder until codegen handles it).
builder.set_type_data(
REGEXP_EXEC_ID,
TypeData::from(Function {
is_async: false,
type_parameters: Default::default(),
name: Some(Text::new_static(REGEXP_EXEC_ID_NAME)),
parameters: Default::default(),
- return_type: ReturnType::Type(GLOBAL_INSTANCEOF_REGEXP_ID.into()),
+ // TODO: Should return RegExpExecArray | null
+ return_type: ReturnType::Type(TypeReference::unknown()),
}),
);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| builder.set_type_data( | |
| REGEXP_EXEC_ID, | |
| TypeData::from(Function { | |
| is_async: false, | |
| type_parameters: Default::default(), | |
| name: Some(Text::new_static(REGEXP_EXEC_ID_NAME)), | |
| parameters: Default::default(), | |
| return_type: ReturnType::Type(GLOBAL_INSTANCEOF_REGEXP_ID.into()), | |
| }), | |
| ); | |
| builder.set_type_data( | |
| REGEXP_EXEC_ID, | |
| TypeData::from(Function { | |
| is_async: false, | |
| type_parameters: Default::default(), | |
| name: Some(Text::new_static(REGEXP_EXEC_ID_NAME)), | |
| parameters: Default::default(), | |
| // TODO: Should return RegExpExecArray | null | |
| return_type: ReturnType::Type(TypeReference::unknown()), | |
| }), | |
| ); |
🤖 Prompt for AI Agents
In crates/biome_js_type_info/src/globals.rs around lines 398 to 407, the builder
currently sets RegExp.prototype.exec return type to GLOBAL_INSTANCEOF_REGEXP_ID
(a RegExp) which is incorrect; change the return_type to a union of the
RegExpExecArray type and null (or use an Unknown placeholder until codegen
supports the specific RegExpExecArray type): locate the TypeData::from(Function
{ ... return_type: ... }) for REGEXP_EXEC_ID and replace
GLOBAL_INSTANCEOF_REGEXP_ID.into() with the appropriate union type identifier
(e.g., REGEXP_EXEC_ARRAY_ID.union_with(NULL_ID).into() or UNKNOWN_ID.into()) so
the signature reflects RegExpExecArray | null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arendjr I copied what you had in https://github.com/biomejs/biome/pull/8166/files#diff-16f1cf097687c58ae8e671748408950c996a5cb0d8880c9e02daaa9e56e2f7ffR227-R236 and removed the function because it's not reused anywhere. But I think this catch sounds correct?
|
@arendjr This is not a complete implementation but it sets a direction for what I want to do. Regardless, It should leave I preserved the old type names to make sure I'm not breaking anything. This approach is not scalable and needs to be reworked as I implement the codegen to for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
crates/biome_js_type_info/src/globals.rs (1)
399-407: RegExp.exec return type is still modelled asRegExp
REGEXP_EXEC_IDis still returningGLOBAL_INSTANCEOF_REGEXP_ID, which impliesRegExp.prototype.exec()returns aRegExpinstance, whereas the runtime API returnsRegExpExecArray | null. Even if you don't want to modelRegExpExecArrayyet, using anUnknownplaceholder (or a TODO union) would avoid encoding an incorrect signature until codegen fills this in.
🧹 Nitpick comments (1)
crates/biome_js_type_info/src/globals.rs (1)
31-43:global_type_name+GLOBAL_TYPE_MEMBERSlook good, consider tightening the fallbackThe
Option‑returningglobal_type_nameplus"unknown"fallback keeps snapshot formatting stable even if a new ID misses a name, which is a reasonable trade‑off for now. As a small follow‑up once codegen lands, you might want a debug assertion that all IDs< NUM_PREDEFINED_TYPEShave a name so missing mappings fail loudly during development rather than silently showing"unknown".Also applies to: 45-97
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
crates/biome_js_type_info/src/format_type_info.rs(1 hunks)crates/biome_js_type_info/src/globals.rs(9 hunks)crates/biome_js_type_info/src/resolver.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/biome_js_type_info/src/format_type_info.rs
- crates/biome_js_type_info/src/resolver.rs
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use the Rustdbg!()macro for debugging output during test execution, and pass the--show-outputflag tocargo testto display debug output.
Use snapshot testing with theinstacrate for testing in Rust projects. Accept or reject snapshots usingcargo insta accept,cargo insta reject, orcargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against thenextbranch of the website repository.
Set theversionmetadata field in linter rule implementations to'next'for newly created rules. Update this field to the new version number when releasing a minor or major version.
Files:
crates/biome_js_type_info/src/globals.rs
crates/biome_js_type_info/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)
crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind anArc
UseTypeReferenceinstead ofArcfor types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures withArcfor improved data locality and performance
UseTypeReferencevariants (Qualifier,Resolved,Import,Unknown) to represent different phases of type resolution
UseTypeData::Unknownto indicate when type inference falls short or is not implemented
Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types
When usingResolvedTypeData, track theResolverIdto ensure subsequent resolver calls use the correct context
Always apply the correctResolverIdwhen retrieving raw type data fromResolvedTypeData.as_raw_data()to prevent panics during subsequent resolution calls
Files:
crates/biome_js_type_info/src/globals.rs
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-09-09T18:10:05.095Z
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_type_info/src/globals.rs
🧬 Code graph analysis (1)
crates/biome_js_type_info/src/globals.rs (4)
crates/biome_js_type_info/src/resolver.rs (8)
from_level(139-141)new(55-57)new(294-299)name(503-505)from(326-328)from(333-335)from(405-410)from(415-420)crates/biome_js_type_info/src/type_data.rs (19)
new(39-43)new(1436-1440)new(1471-1481)default(168-170)default(810-812)default(1224-1226)name(951-953)name(999-1005)from(174-176)from(180-182)from(186-188)from(192-194)from(198-200)from(204-206)from(210-212)from(216-218)from(222-224)from(228-230)from(234-236)crates/biome_js_type_info/src/type_data/literal.rs (1)
new(34-36)crates/biome_js_type_info/src/globals_builder.rs (2)
default(58-60)with_capacity(16-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_tailwind_parser)
- GitHub Check: Documentation
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: autofix
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_module_graph)
🔇 Additional comments (3)
crates/biome_js_type_info/src/globals.rs (3)
20-23: Nice separation of concerns for globals metadataImporting
GlobalsResolverBuilderand re‑exporting the IDs fromglobals_idsmakes the globals surface much easier to consume and keeps the ID definitions in one place; no issues here.
105-107: GlobalsResolver visibility and helper closures are reasonableMaking
typespub(crate)to allow builder‑based initialisation is fine given the crate‑internal scope, and the helper closures usingglobal_type_name(id).unwrap_or("unknown")keep method names consistent with the ID metadata without re‑hardcoding strings. This all fits neatly with the new ID/name separation.Also applies to: 120-151
156-411: Builder-based initialisation of globals is a solid improvementThe switch to
GlobalsResolverBuilder::with_capacity(NUM_PREDEFINED_TYPES)and explicitset_type_datacalls removes the brittle dependency on vec indices and keeps all predefined globals in one clearly structured block. The usage ofTypeReferenceand a linearTypeStorefor these entries matches thebiome_js_type_infoguidelines on type storage and references, and the IDs wired here line up with the ones handled inglobal_type_name, so I don't see any obvious gaps. Based on learnings, this is a good direction for future codegen to extend safely.
arendjr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
3780260 to
16432a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (2)
crates/biome_js_type_info/src/globals_builder.rs (1)
39-44: Tiny readability nit on theArc::newmappingThe nested line break around
Arc::newis a bit awkward; you can make this easier on the eyes without changing behaviour:- let types: Vec<Arc<TypeData>> = self - .types - .into_iter() - .map(|opt| Arc::new( - opt.unwrap_or(TypeData::Unknown))) - .collect(); + let types: Vec<Arc<TypeData>> = self + .types + .into_iter() + .map(|opt| Arc::new(opt.unwrap_or(TypeData::Unknown))) + .collect();crates/biome_js_type_info/src/globals.rs (1)
385-407:RegExp.prototype.execreturn type is still modelled asRegExp, which is incorrectIn JS,
RegExp.prototype.exec()returns a match array (commonlyRegExpExecArray) ornull, not aRegExpinstance; modelling it asGLOBAL_INSTANCEOF_REGEXP_IDwill give clearly wrong downstream types (e.g.exec()results flowing asRegExp). Until you introduce a properRegExpExecArray | nulltype, it would be less misleading to returnunknownhere.builder.set_type_data( REGEXP_EXEC_ID, TypeData::from(Function { is_async: false, type_parameters: Default::default(), name: Some(Text::new_static(REGEXP_EXEC_ID_NAME)), parameters: Default::default(), - return_type: ReturnType::Type(GLOBAL_INSTANCEOF_REGEXP_ID.into()), + // TODO: RegExp.prototype.exec() returns RegExpExecArray | null. + // Use `unknown` for now until we have a dedicated exec-array type. + return_type: ReturnType::Type(TypeReference::unknown()), }), );
🧹 Nitpick comments (1)
crates/biome_js_type_info/src/globals.rs (1)
31-42: Name table viaglobal_type_namelooks reasonable, with only a small footgunCentralising the ID→name mapping and using
Optionwith an"unknown"fallback forGLOBAL_TYPE_MEMBERSis a nice step towards codegen and keeps snapshots stable; just be mindful that forgetting to add a new ID toglobal_type_namewill now silently show up as"unknown"rather than a hard failure, so a future debug-only check or test around this table might be worth adding once codegen lands.Also applies to: 44-96
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
crates/biome_js_type_info/src/globals.rs(10 hunks)crates/biome_js_type_info/src/globals_builder.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use the Rustdbg!()macro for debugging output during test execution, and pass the--show-outputflag tocargo testto display debug output.
Use snapshot testing with theinstacrate for testing in Rust projects. Accept or reject snapshots usingcargo insta accept,cargo insta reject, orcargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against thenextbranch of the website repository.
Set theversionmetadata field in linter rule implementations to'next'for newly created rules. Update this field to the new version number when releasing a minor or major version.
Files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
crates/biome_js_type_info/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)
crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind anArc
UseTypeReferenceinstead ofArcfor types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures withArcfor improved data locality and performance
UseTypeReferencevariants (Qualifier,Resolved,Import,Unknown) to represent different phases of type resolution
UseTypeData::Unknownto indicate when type inference falls short or is not implemented
Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types
When usingResolvedTypeData, track theResolverIdto ensure subsequent resolver calls use the correct context
Always apply the correctResolverIdwhen retrieving raw type data fromResolvedTypeData.as_raw_data()to prevent panics during subsequent resolution calls
Files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-09-09T18:10:05.095Z
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:27.784Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.784Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the `dbg_write!` macro to debug formatter output instead of other logging methods
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
🧬 Code graph analysis (1)
crates/biome_js_type_info/src/globals.rs (1)
crates/biome_js_type_info/src/globals_builder.rs (2)
default(53-55)with_capacity(16-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (17)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_tailwind_parser)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: autofix
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_graphql_formatter)
🔇 Additional comments (2)
crates/biome_js_type_info/src/globals.rs (1)
107-155: Builder‑basedGlobalsResolver::defaultis a big improvement over index jugglingSwitching to
GlobalsResolverBuilder::with_capacity(NUM_PREDEFINED_TYPES)and explicitlyset_type_datacalls for all predefined IDs removes the brittle coupling between ID integers, vector indices, and names; this should make future manual and generated globals much less painful while still aligning with the “linear TypeStore + TypeReference” guidance in CONTRIBUTING.Also applies to: 168-336, 373-387
crates/biome_js_type_info/src/globals_builder.rs (1)
9-20: Builder design +Unknownfallback match the intended inference storyUsing a
Vec<Option<TypeData>>with debug‑only bounds/single‑assignment checks inset_type_data, and defaulting missing entries toTypeData::Unknowninbuild(), gives you forward references without runtime panics and lines up neatly with the CONTRIBUTING guidance to preferUnknownover crashing when inference data is incomplete. This looks like the right foundation for generated globals.Also applies to: 22-35, 37-49, 52-56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
crates/biome_js_type_info/src/globals_builder.rs (2)
9-35: Builder invariants and use ofTypeData::Unknownlook soundThe overall builder shape (pre-sized
Vec<Option<TypeData>>,set_type_datawith debug-only checks, and leaving release builds without extra panics) looks solid, and usingTypeData::Unknownfor unfilled slots matches the guidance to represent “missing/inferred later” global types without blowing up construction. Just make sure call-sites treat these as “inference not available yet” rather than user-authoredunknown.Based on learnings, this aligns with storing type data in linear vectors and using
TypeData::Unknownfor incomplete inference.
37-47: Considerunwrap_or_elseto avoid redundantUnknownconstructionTiny micro-optimisation/idiom point:
unwrap_orwill construct aTypeData::Unknownfor every slot, even when it’s not used.unwrap_or_elseavoids that and keeps intent clear:- let types: Vec<Arc<TypeData>> = self - .types - .into_iter() - .map(|opt| Arc::new(opt.unwrap_or(TypeData::Unknown))) - .collect(); + let types: Vec<Arc<TypeData>> = self + .types + .into_iter() + .map(|opt| Arc::new(opt.unwrap_or_else(|| TypeData::Unknown))) + .collect();Not critical at this scale, but a bit more idiomatic.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
crates/biome_js_type_info/src/globals_builder.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use the Rustdbg!()macro for debugging output during test execution, and pass the--show-outputflag tocargo testto display debug output.
Use snapshot testing with theinstacrate for testing in Rust projects. Accept or reject snapshots usingcargo insta accept,cargo insta reject, orcargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against thenextbranch of the website repository.
Set theversionmetadata field in linter rule implementations to'next'for newly created rules. Update this field to the new version number when releasing a minor or major version.
Files:
crates/biome_js_type_info/src/globals_builder.rs
crates/biome_js_type_info/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)
crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind anArc
UseTypeReferenceinstead ofArcfor types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures withArcfor improved data locality and performance
UseTypeReferencevariants (Qualifier,Resolved,Import,Unknown) to represent different phases of type resolution
UseTypeData::Unknownto indicate when type inference falls short or is not implemented
Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types
When usingResolvedTypeData, track theResolverIdto ensure subsequent resolver calls use the correct context
Always apply the correctResolverIdwhen retrieving raw type data fromResolvedTypeData.as_raw_data()to prevent panics during subsequent resolution calls
Files:
crates/biome_js_type_info/src/globals_builder.rs
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.337Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.337Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:42.338Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.338Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:27.784Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.784Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the `dbg_write!` macro to debug formatter output instead of other logging methods
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
🧬 Code graph analysis (1)
crates/biome_js_type_info/src/globals_builder.rs (3)
crates/biome_js_type_info/src/resolver.rs (5)
id(72-74)index(77-79)index(301-303)new(55-57)new(294-299)crates/biome_js_type_info/src/type_store.rs (1)
from_types(35-45)crates/biome_js_type_info/src/globals.rs (1)
default(108-410)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (23)
- GitHub Check: Documentation
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_tailwind_parser)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_package)
…ilder with initial capacity
This reverts commit 4fb63b4.
Co-authored-by: Arend van Beelen jr. <[email protected]>
6cb3d82 to
ab2cde2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
crates/biome_js_type_info/src/globals.rs (1)
398-407: RegExp.exec still returns a RegExp instance instead of a match arrayThis still models
RegExp.prototype.execas returning aRegExp(GLOBAL_INSTANCEOF_REGEXP_ID), whereas the JS signature is effectivelyRegExpExecArray | null. Even if you’d prefer to keep this refactor behaviour‑preserving, swapping to anunknownplaceholder would avoid advertising the wrong return type until you have a proper match‑array type.builder.set_type_data( REGEXP_EXEC_ID, TypeData::from(Function { is_async: false, type_parameters: Default::default(), name: Some(Text::new_static(REGEXP_EXEC_ID_NAME)), parameters: Default::default(), - return_type: ReturnType::Type(GLOBAL_INSTANCEOF_REGEXP_ID.into()), + // TODO: RegExp.prototype.exec should return RegExpExecArray | null. + // Use an unknown placeholder for now until that type is modelled. + return_type: ReturnType::Type(TypeReference::unknown()), }), );
🧹 Nitpick comments (3)
crates/biome_js_type_info/src/format_type_info.rs (1)
575-635: Global type formatting fallback looks correctUsing
global_type_name(id)first and only shifting the index in theNonecase keeps snapshot indices stable and avoids the earlier underflow, given the current exhaustive mapping inglobal_type_name. You might very lightly rephrase the comment aboutGLOBAL_TYPE_MEMBERS“ensuring” the invariant, since it currently just consumes the names and the real contract lives inglobal_type_name/ codegen, but functionally this is fine.crates/biome_js_type_info/src/globals.rs (1)
31-42: Make the “all predefined have names” invariant explicit in debug buildsRight now the invariant that all
TypeId < NUM_PREDEFINED_TYPEShave a name lives in convention plus this manual match;GLOBAL_TYPE_MEMBERSwill quietly fall back to"unknown"if an entry is missed. If you want to lean on that invariant elsewhere (e.g. for safe index shifting in formatting), a tiny debug‑only assertion here would make future additions fail loudly when a name is forgotten, while still defaulting to"unknown"in release.- .map(|id| { - let name = global_type_name(id).unwrap_or("unknown"); + .map(|id| { + let name = global_type_name(id).unwrap_or_else(|| { + debug_assert!( + false, + "Missing global_type_name for predefined TypeId index {}", + id.index() + ); + "unknown" + });Also applies to: 44-96
crates/biome_js_type_info/src/globals_ids.rs (1)
13-76: Macro-based global ID table is fine as a temporary bridgeThe sequential indices and names all line up with
global_type_nameand the builder, andNUM_PREDEFINED_TYPES = 44matches the highest index of 43. Given this is explicitly a stopgap until codegen, I’m fine with thepastedependency; if you ever want to keep it longer‑term, you might consider dropping#[macro_export]sodefine_global_type!doesn’t leak into the public API unnecessarily.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lockand included by**
📒 Files selected for processing (7)
crates/biome_js_type_info/Cargo.toml(1 hunks)crates/biome_js_type_info/src/format_type_info.rs(1 hunks)crates/biome_js_type_info/src/globals.rs(10 hunks)crates/biome_js_type_info/src/globals_builder.rs(1 hunks)crates/biome_js_type_info/src/globals_ids.rs(1 hunks)crates/biome_js_type_info/src/lib.rs(2 hunks)crates/biome_js_type_info/src/resolver.rs(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/biome_js_type_info/src/resolver.rs
- crates/biome_js_type_info/src/lib.rs
🧰 Additional context used
📓 Path-based instructions (3)
**/Cargo.toml
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Use workspace dependencies defined in the root
Cargo.tomlfor internal crates, specifyingworkspace = truein each crate's Cargo.toml. Use path dependencies for dev-dependencies to avoid requiring published versions.
Files:
crates/biome_js_type_info/Cargo.toml
**/*.rs
📄 CodeRabbit inference engine (CONTRIBUTING.md)
**/*.rs: Use the Rustdbg!()macro for debugging output during test execution, and pass the--show-outputflag tocargo testto display debug output.
Use snapshot testing with theinstacrate for testing in Rust projects. Accept or reject snapshots usingcargo insta accept,cargo insta reject, orcargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against thenextbranch of the website repository.
Set theversionmetadata field in linter rule implementations to'next'for newly created rules. Update this field to the new version number when releasing a minor or major version.
Files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
crates/biome_js_type_info/**/*.rs
📄 CodeRabbit inference engine (crates/biome_js_type_info/CONTRIBUTING.md)
crates/biome_js_type_info/**/*.rs: No module may copy or clone data from another module in the module graph, not even behind anArc
UseTypeReferenceinstead ofArcfor types that reference other types to avoid stale cache issues when modules are replaced
Store type data in linear vectors instead of using recursive data structures withArcfor improved data locality and performance
UseTypeReferencevariants (Qualifier,Resolved,Import,Unknown) to represent different phases of type resolution
UseTypeData::Unknownto indicate when type inference falls short or is not implemented
Distinguish betweenTypeData::UnknownandTypeData::UnknownKeywordto measure inference effectiveness versus explicit user-provided unknown types
When usingResolvedTypeData, track theResolverIdto ensure subsequent resolver calls use the correct context
Always apply the correctResolverIdwhen retrieving raw type data fromResolvedTypeData.as_raw_data()to prevent panics during subsequent resolution calls
Files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
🧠 Learnings (24)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
📚 Learning: 2025-11-24T18:05:20.371Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:20.371Z
Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replaced
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:03:52.024Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.024Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/format_type_info.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Store type data in linear vectors instead of using recursive data structures with `Arc` for improved data locality and performance
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Distinguish between `TypeData::Unknown` and `TypeData::UnknownKeyword` to measure inference effectiveness versus explicit user-provided unknown types
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:03:52.024Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.024Z
Learning: Applies to **/Cargo.toml : Use workspace dependencies defined in the root `Cargo.toml` for internal crates, specifying `workspace = true` in each crate's Cargo.toml. Use path dependencies for dev-dependencies to avoid requiring published versions.
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeData::Unknown` to indicate when type inference falls short or is not implemented
Applied to files:
crates/biome_js_type_info/Cargo.tomlcrates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Create two new crates `biome_{language}_syntax` and `biome_{language}_factory` using `cargo new --lib` for new language parsers
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:06:03.545Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.545Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new variant to `LanguageKind` enum in `language_kind.rs` file and implement all methods for the new language variant
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:06:12.048Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_service/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:12.048Z
Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instances
Applied to files:
crates/biome_js_type_info/Cargo.toml
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Always apply the correct `ResolverId` when retrieving raw type data from `ResolvedTypeData.as_raw_data()` to prevent panics during subsequent resolution calls
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : When using `ResolvedTypeData`, track the `ResolverId` to ensure subsequent resolver calls use the correct context
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` variants (`Qualifier`, `Resolved`, `Import`, `Unknown`) to represent different phases of type resolution
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/scoped_resolver.rs : Implement full inference to resolve `TypeReference::Import` variants across the entire module graph
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-08-20T16:24:59.781Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7266
File: crates/biome_js_type_info/src/type.rs:94-102
Timestamp: 2025-08-20T16:24:59.781Z
Learning: In crates/biome_js_type_info/src/type.rs, the flattened_union_variants() method returns TypeReference instances that already have the correct module IDs applied to them. These references should be used directly with resolver.resolve_reference() without applying additional module ID transformations, as variant references may originate from nested unions in different modules.
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/flattening.rs : Implement type flattening to simplify `TypeofExpression` variants once all component types are resolved
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_builder.rscrates/biome_js_type_info/src/format_type_info.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/js_module_info/collector.rs : Implement module-level (thin) inference to resolve `TypeReference::Qualifier` variants by looking up declarations in module scopes and handling import statements
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/format_type_info.rs
📚 Learning: 2025-11-24T18:04:42.160Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_analyze/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:42.160Z
Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules that ban functions or variables should use the semantic model to check if the variable is global before reporting, to avoid false positives on locally redeclared variables
Applied to files:
crates/biome_js_type_info/src/globals.rs
📚 Learning: 2025-09-09T18:10:05.095Z
Learnt from: arendjr
Repo: biomejs/biome PR: 6710
File: crates/biome_js_type_info/src/helpers.rs:102-124
Timestamp: 2025-09-09T18:10:05.095Z
Learning: Global constants like GLOBAL_ARRAY_ID are stored by the global resolver and should never have module IDs applied to them. Module IDs only apply to module resolvers, not global resolvers. When working with global type constants, use them directly without module ID transformations.
Applied to files:
crates/biome_js_type_info/src/globals.rscrates/biome_js_type_info/src/globals_ids.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the `dbg_write!` macro to debug formatter output instead of other logging methods
Applied to files:
crates/biome_js_type_info/src/globals_builder.rs
📚 Learning: 2025-11-24T18:05:27.810Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.810Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When formatting AST nodes, use mandatory tokens from the AST instead of hardcoding token strings (e.g., use `node.l_paren_token().format()` instead of `token("(")`)
Applied to files:
crates/biome_js_type_info/src/format_type_info.rs
📚 Learning: 2025-11-24T18:05:42.356Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:42.356Z
Learning: Applies to crates/biome_js_type_info/**/local_inference.rs : Implement local inference in dedicated modules to derive type definitions from expressions without context of surrounding scopes
Applied to files:
crates/biome_js_type_info/src/format_type_info.rs
🧬 Code graph analysis (3)
crates/biome_js_type_info/src/globals_builder.rs (2)
crates/biome_js_type_info/src/type_store.rs (1)
from_types(35-45)crates/biome_js_type_info/src/globals.rs (1)
default(108-410)
crates/biome_js_type_info/src/format_type_info.rs (1)
crates/biome_js_type_info/src/globals.rs (1)
global_type_name(46-96)
crates/biome_js_type_info/src/globals_ids.rs (1)
crates/biome_js_type_info/src/resolver.rs (2)
new(55-57)new(294-299)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
- GitHub Check: Test Node.js API
- GitHub Check: Bench (biome_configuration)
- GitHub Check: Documentation
- GitHub Check: Bench (biome_json_analyze)
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Bench (biome_json_formatter)
- GitHub Check: autofix
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Bench (biome_json_parser)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Check Dependencies
- GitHub Check: Bench (biome_graphql_formatter)
- GitHub Check: Bench (biome_graphql_parser)
- GitHub Check: Bench (biome_module_graph)
- GitHub Check: Bench (biome_css_analyze)
- GitHub Check: Bench (biome_css_parser)
- GitHub Check: Bench (biome_tailwind_parser)
- GitHub Check: Bench (biome_css_formatter)
- GitHub Check: Bench (biome_package)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_analyze)
🔇 Additional comments (4)
crates/biome_js_type_info/Cargo.toml (1)
25-25: Based on the verification results, I can now rewrite the review comment. The web search confirms thatpasteis a standard external crate used for compile-time macro identifier concatenation. However, I found an important distinction: the original review conflates internal workspace crates (which useworkspace = true) with external crates (which should useworkspace.dependencies).Ensure
pastedependency is defined in rootworkspace.dependencies.The external dependency
paste = "1.0"should be managed at the workspace level rather than declared individually in each crate'sCargo.toml. Per Cargo best practices for workspaces, move this to the rootCargo.tomlunder[workspace.dependencies]and reference it in this crate withpaste = { workspace = true }. This prevents version duplication and ensures all crates in the workspace use the samepasteversion.⛔ Skipped due to learnings
Learnt from: CR Repo: biomejs/biome PR: 0 File: CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:03:52.024Z Learning: Applies to **/Cargo.toml : Use workspace dependencies defined in the root `Cargo.toml` for internal crates, specifying `workspace = true` in each crate's Cargo.toml. Use path dependencies for dev-dependencies to avoid requiring published versions.Learnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_service/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:06:12.048Z Learning: Applies to crates/biome_service/src/workspace*.rs : Implement the Workspace trait in the Biome Service to manage internal state of projects, including open documents, project layout instances, and module graph instancesLearnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_formatter/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:05:20.371Z Learning: Applies to crates/biome_formatter/**/biome_*_formatter/Cargo.toml : Include development dependencies in `Cargo.toml` for formatter tests: `biome_formatter_test`, `biome_<language>_factory`, `biome_<language>_parser`, `biome_parser`, `biome_service`, `countme`, `iai`, `quickcheck`, `quickcheck_macros`, and `tests_macros`Learnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_service/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:06:12.048Z Learning: Applies to crates/biome_service/src/workspace/watcher.tests.rs : Implement watcher tests for workspace methods in watcher.tests.rs and end-to-end tests in LSP testsLearnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_js_type_info/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:05:42.356Z Learning: Applies to crates/biome_js_type_info/**/*.rs : Use `TypeReference` instead of `Arc` for types that reference other types to avoid stale cache issues when modules are replacedLearnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_analyze/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:04:42.160Z Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Multi-file documentation snippets should use 'file=<path>' property to create an in-memory file system for testing cross-file rule behaviorLearnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_analyze/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:04:42.160Z Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The 'declare_lint_rule!' macro must include a 'version' field set to 'next' to allow flexibility for the actual release versionLearnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_analyze/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:04:42.160Z Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : Rules ported from other ecosystems should include a 'sources' field in the 'declare_lint_rule!' macro with RuleSource metadata (e.g., '::ESLint')Learnt from: CR Repo: biomejs/biome PR: 0 File: crates/biome_analyze/CONTRIBUTING.md:0-0 Timestamp: 2025-11-24T18:04:42.160Z Learning: Applies to crates/biome_analyze/**/biome_*_analyze/lib/src/**/!(mod).rs : The first paragraph of rule documentation must be a single line and serves as the brief description for the rule overview pagecrates/biome_js_type_info/src/globals_builder.rs (1)
1-56: GlobalsResolverBuilder design matches the intended storage modelThe builder +
Option<TypeData>layout cleanly decouples ID ordering from construction, and theTypeData::Unknowndefault for unfilled slots is a sensible (and documented) fallback for missing definitions. The debug assertions give you safety in debug without affecting release, so this looks good to ship as the base for future codegen.crates/biome_js_type_info/src/globals.rs (1)
98-409: Builder‑based GlobalsResolver initialisation is a nice clean‑upSwitching the globals initialisation to
GlobalsResolverBuilderremoves the fragile dependence on Vec ordering, keeps everything in a single linearTypeStore, and uses theGLOBAL_*resolved IDs consistently for cross‑links. This is a solid base for the planned codegen and should make extending the global set much less error‑prone.crates/biome_js_type_info/src/globals_ids.rs (1)
78-116: ResolvedTypeId globals are wired consistentlyThe
GLOBAL_*resolved IDs here match the correspondingTypeIds and the way they’re consumed inglobals.rs(array, promise, typeof string literals, fetch, RegExp, etc.), all atGLOBAL_LEVEL. Nothing stands out as inconsistent.
ematipico
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @tidefield !
…iomejs#8253) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Arend van Beelen jr. <[email protected]>
Biome's handling for global types has a limitation that makes it very hard to do #5977, write codegen from
.d.tsto Rust, and manually add new global types.The types (which becomes the backbone data structure for the type store) is
biome/crates/biome_js_type_info/src/globals.rs
Lines 241 to 246 in 98ca2ae
Here, the vec indices need to match with type IDs defined in
biome/crates/biome_js_type_info/src/globals.rs
Lines 36 to 40 in 98ca2ae
Also, we have to deal with this function where the indices need to match up too.
biome/crates/biome_js_type_info/src/globals.rs
Lines 121 to 127 in 98ca2ae
From a manual perspective (where we are now), every index, ID, and name strings are manually tracked. It could be error-prone and likely becomes source of breaking changes and merge conflicts. #8166 is how much code needed for RegExp globals.
From a codegen perspective (what we're aiming for), the codegen needs two-pass: one for storing all IDs in memory, and another for unpacking those IDs to generate the
typesvec.This PR refactors the unnecessary thinkings (specific ID integers, indices, names, etc) out of
globals.rs.My follow-up PR will implement a codegen to
Even without the follow-up PR, this PR is meant to leave the codebase in a better place for further manual extensions.
@arendjr I intentionally removed and added back the RegExp globals in d417edd in a separate commit to compare with #8166 that basically does the same thing. That is the recap of what I want to do in this PR.
Related: #5977