Merged
Conversation
705f89e to
d944c46
Compare
c643895 to
aca46d5
Compare
This comment was marked as spam.
This comment was marked as spam.
zakora31
approved these changes
Jul 10, 2024
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.
Currently, the type inference mechanism is very simple in that in infers types for a variable based only on the last seen assignment to the variable. This has shortcomings for scenarios like the following, where the type may differ based on the branch taken.
To make the type checker more accurate in these situations, this PR introduces a primitive form of data-flow analysis heavily based on Pyright and, by extension, the TypeScript compiler. This includes constructing a code-flow graph as an additional lowering step and using it to determine types as part of the type checker. While under active development, this functionality will be gated behind the
--experimental_use_code_flow_analysisflag.Tasks:
ifstatementsforloopsifstatementsforloops--experimental_use_code_flow_analysisflag