-
-
Notifications
You must be signed in to change notification settings - Fork 603
feat(core): add ModuleId
to ResolvedTypeId
#5809
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
Conversation
CodSpeed Performance ReportMerging #5809 will not alter performanceComparing Summary
|
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 good! Left some comments but feel free to merge it whenever
/// Only the two least significant bits may be set in order to let the type | ||
/// fit into `ResolvedTypeId`. If more bits become necessary, we may need to | ||
/// rebalance the layout of `ResolvedTypeId`. | ||
pub const fn from_u2(bits: u32) -> Self { |
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.
from_u32
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.
I actually named it like that on purpose, to make people conscious of the size restraint, even if we don't have a real u2
type :)
Summary
I'm trying to avoid another huge PR, so I'm taking some smaller steps here :)
The main change in this PR is that
ResolvedTypeId
can now contain aModuleId
in addition to aTypeId
. Such aModuleId
would only be used in combination withTypeResolverLevel::Module
, but with a catch: The types stored in the module graph would not contain these module IDs, because it brings all kinds of complexity if a module needs to know its own ID. So the idea for now is that theAdHocTypeResolver
will attach these module IDs at resolution time in order to keep track of which modules given types came from. I'm not yet sure it will be as easy as this, but that's the direction I'm going in.Other changes are:
JsResolvedPath
andJsImportSymbol
have been moved frombiome_module_graph
tobiome_js_type_info
. This allows us to store the information from where to resolve a given type reference directly intoTypeReference
itself. TheJsModuleInfoCollector
now convertsResolvedTypeId
s ofTypeResolverLevel::Project
into suchTypeReference::Imported
variants.ResolvedTypeId
withTypeResolverLevel::Project
as binding ID. It feels a little bit hacky, but it still feels better than introducing anotherTypeData
variant for such a temporary purpose, because then it would leak into the rest of the type system.biome_module_graph
now has its ownBindingId
instead of using theBindingId
frombiome_js_semantic
. ThisBindingId
has aFrom<TypeId>
implementation, and vice versa.biome_module_graph
that we weren't actually using.Test Plan
CI should remain green.