Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant performance and maintainability improvements to the control flow graph (
Graph) and type inference logic in the compiler. The main focus is on optimizing symbol and version lookups by introducing dense, point-indexed data structures, and on refactoring the type inference pipeline to be more efficient and robust. Additional utility functions are added to support these changes, and the type containment logic is rewritten for correctness and recursion safety.Control Flow Graph: Dense Lookups and API Improvements
visibleVersionByPointandsymbolScopeByPointtoGraph, providing fast, dense, point-indexed access to symbol versions and scopes, reducing map lookups during compilation.GraphinBuildWithBindingsandBuildBlockto populate these dense structures, and introduced helper functionsdenseVisibleVersionByPointanddenseSymbolScopeByPoint. [1] [2]VisibleVersion,AllVisibleVersions,SymbolAt,AllSymbolsAt) to use the new dense arrays when possible, falling back to maps for sparse points. IntroducedLocalSymbolsAtand internalized point-local symbol lookup logic. [1] [2] [3] [4] [5]Type Inference Pipeline: Efficiency and Robustness
synthWithInferenceOverlayto unify and simplify the creation of type overlays for inference, replacing repeated code. [1] [2] [3]normalizedCallArgSymbolsandcallRefSymbolsto robustly extract symbol IDs from call arguments and references, improving accuracy of dependency tracking in inference.Type Containment Logic: Correctness and Recursion Safety
typeContainsto use a depth-first, recursion-guarded traversal (typeContainsDepth), ensuring correct handling of recursive types and annotated wrappers, and preventing infinite loops.