-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
inference: refine PartialStruct lattice tmerge #44404
Merged
Merged
Conversation
This file contains 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
aviatesk
reviewed
Mar 3, 2022
aviatesk
reviewed
Mar 3, 2022
47 tasks
Previously we assumed only union type could have complexity that violated the tmerge lattice requirements, but other types can have that too. This lets us fix an issue with the PartialStruct comparison failing for undefined fields, mentioned in #43784.
These commits shouldn't be squashed. |
aviatesk
reviewed
Mar 13, 2022
Comment on lines
+473
to
+476
# compute typeintersect over the extended inference lattice, | ||
# as precisely as we can, | ||
# where v is in the extended lattice, and t is a Type. | ||
function tmeet(@nospecialize(v), @nospecialize(t)) |
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.
Duplicated with the definition at L295.
KristofferC
pushed a commit
that referenced
this pull request
Mar 13, 2022
* inference: fix tmerge lattice over issimpleenoughtype Previously we assumed only union type could have complexity that violated the tmerge lattice requirements, but other types can have that too. This lets us fix an issue with the PartialStruct comparison failing for undefined fields, mentioned in #43784. * inference: refine PartialStruct lattice tmerge Be more aggressive about merging fields to greatly accelerate convergence, but also compute anyrefine more correctly as we do now elsewhere (since #42831, a121721) Move the tmeet algorithm, without changes, since it is a precise lattice operation, not a heuristic limit like tmerge. Close #43784 (cherry picked from commit ff88fa4)
aviatesk
added a commit
that referenced
this pull request
Mar 15, 2022
aviatesk
added a commit
that referenced
this pull request
Mar 15, 2022
Keno
pushed a commit
that referenced
this pull request
Mar 15, 2022
aviatesk
added a commit
that referenced
this pull request
Mar 16, 2022
KristofferC
pushed a commit
that referenced
this pull request
Mar 16, 2022
aviatesk
added a commit
that referenced
this pull request
Dec 20, 2022
…47910) When merging `PartialStruct`, we are currently merging their fields a bit aggressively (#44404) in order to accelerate (or rather, guarantee) convergence. However, when `PartialStruct` wraps external lattice elements, this can be too aggressive since it does not use `tmerge(𝕃, fields...)` recursively and thus the external lattice elements are not merged as expected. This commit adds an additional lattice hook, `tmerge_field`, inside `tmerge(::PartialsLattice)` so that external lattice implementation can provide its own field-merge strategies.
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.
Be more aggressive about merging fields to greatly accelerate
convergence, but also compute anyrefine more correctly as we do now
elsewhere (since #42831, a121721)
Move the tmeet algorithm, without changes, since it is a precise lattice
operation, not a heuristic limit like tmerge.
Close #43784