-
Notifications
You must be signed in to change notification settings - Fork 13.3k
region unification: update universe of region vars #121442
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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.
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.
if we equate an infer var with a root which is in a higher universe, we previously did not return that root vid here. This caused the
PlaceholderReplacer
to not map a placeholder region back to a bound var indeeply_normalize
(with #119106) due to the following setup:for<'a> fn(RigidAlias<'a>)
gets instantiated asfn(RigidAlias<'!a>)
RigidAlias<'!a>
emitsAliasRelate(RigidAlias<'!a>, ?u)
exists<U> exists<'a> AliasRelate(RigidAlias<'a>, U)
RigidAlias<'?a.1>
and?u.0
NormalizesTo
fails, so we first instantiate?u.0
withRigidAlias<'new.whatever>
, the universe of that gets pulled down into universe0
RigidAlias<'new.0>
withRigidAlias<'a.1>
, equating'new
and'a
, using'a
as the root in the unification table'new
as'a
because the universe of'a
is higher than the universe of'new
RigidAlias<'!a>
normalizes toRigidAlias<'new>
where'new
is constrained to be equal to'!a
'new
back to'a
in thePlaceholderReplacer
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.
This looks like an issue with the new solver canonicalization! the universe of
?u
should certainly be able to name'?a
. How does?a
end up in U1 and?u
as U0?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.
In the new solver all regions are canonicalized to new inference variables in a single universe that is higher than everything else in the input.
?u
can name'?a
even with this setup it just requires lowering'?a
's universe when equating it which is something we already do for cases like?x.0 eq ?y.1
. Even if the new solver did not have this canonicalization scheme I would still expect this PR to be required somehow as it is just wrong for'?x.0 eq '?y.1
to not allow resolving'?x
to'?y
later on and there should be other ways to wind up with a region variable in a higher universe that is equated with something in a lower one