Disable distribution of intersection types over applied types#23441
Merged
odersky merged 16 commits intoscala:mainfrom Sep 13, 2025
Merged
Disable distribution of intersection types over applied types#23441odersky merged 16 commits intoscala:mainfrom
odersky merged 16 commits intoscala:mainfrom
Conversation
2daa02b to
6171b84
Compare
EugeneFlesselle
added a commit
to dotty-staging/dotty
that referenced
this pull request
Jul 17, 2025
EugeneFlesselle
added a commit
to dotty-staging/dotty
that referenced
this pull request
Jul 18, 2025
7bf9c7d to
6b20da7
Compare
And add minimization
Instead of AppliedType of OrTypes, which relied on the distribution of AndTypes when inheriting multiple context bound companions of the same name
6b20da7 to
73214ff
Compare
odersky
requested changes
Sep 10, 2025
Contributor
odersky
left a comment
There was a problem hiding this comment.
To be conservative I'd make the main change in distributeAnd conditional on a source version or a -Y flag. That would give applications that critically rely on the unsoundness a way out.
This reverts commit 0441af0 to resolve merge conflict
odersky
approved these changes
Sep 13, 2025
Contributor
odersky
left a comment
There was a problem hiding this comment.
Looks good, thanks for squeezing these changes in your busy schedule!
hamzaremmal
added a commit
to scala/scala-parallel-collections
that referenced
this pull request
Sep 18, 2025
Starting from Scala 3.8.0, the following code will not compile due to removing some unsound typing rules. See scala/scala3#23441 Co-authored-by: Eugene Flesselle <eugene@flesselle.net>
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.
Fixes soundness issue #23435
Note in particular that this implies we cannot (indirectly) inherit multiple instantiations of the same trait. E.g., see tests/neg/conflicting-inst-basetypes.scala.
The impact on the community-build appears to be rather reasonable, tweaks are required:
The changes should be relatively well regrouped by commit for review.