biome
biome copied to clipboard
refactor: revisit type-related data structures
Summary
Another huge one, though thankfully a large part of it are snapshots :sweat_smile:
But that's not to say a lot hasn't changed, so let me elaborate what happened here:
-
Typeis no longer anArc-wrapper aroundTypeInner. I always knew theArc-based solution was temporary, but I admit I hadn't entirely foreseen how big the refactor would become. The reasonArcwouldn't work going forward is because it would get in the way with full inference where types from modules would be able to reference arbitrary types, even from other modules. The problem withArcis that it would keep alive types from those other modules, even when such another module gets replaced by the watcher in the module graph. The full inference story hasn't been completed with this PR, but at least it should pave the way for it. -
TypeDatais stored directly inside vectors managed by resolvers. This makes bulk operations on them cheaper, but more importantly: It made it a lot easier to separate type resolution and flattening into separate steps that are easier to reason about independently. -
Typeis only used through theTypedservice. The new wayTypeworks is much closer to theScopeandBindingtypes from the semantic model. It makes consuming the API easier, but it no longer serves a role during inference. -
TypeReferenceholds an explicit reference to other types. We already had aTypeReferencetype, but the way it works has been heavily changed. Any type that previously held anArc-basedTypein one of its fields, now holds aTypeReferenceinstead. That does mean we have to work through the resolvers more in order to follow those references, but this is exactly what we need so that full inference can follow references to other modules, without co-owning their types.
Test Plan
Everything should remain green.
CodSpeed Performance Report
Merging #5777 will not alter performance
Comparing arendjr:type-refactoring (83f96f9) with main (e950ff9)
Summary
✅ 95 untouched benchmarks