Fix #15405: Dealias Or type constituents when finding its dominator #15416
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.
In the issue,
v: Int
is boxed toRichInt
. This is because the typer can't find>
inInt | Validated[Int]
and attempts an implicit conversion. This is in turn because when looking up members of a union type, we do thejoin
operation on that union type, which attempts to simplify it by reducing it to the intersection of the base classes of its constituents.It seems that this intersection algorithm, while operating on dealiased constituents, does not dealias them at a certain point, thus judging that the intersection of base types of
Int
andValidated[Int]
isAny
. This PR adds such a dealias.Using
Foo
instead ofInt
in tests to remove implicit conversions out of the equation; without the PR's change the test fails.