Skip to content

Conversation

EugeneFlesselle
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle commented Jun 27, 2025

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.

@EugeneFlesselle EugeneFlesselle force-pushed the distributeAnd branch 4 times, most recently from 2daa02b to 6171b84 Compare July 16, 2025 15:35
EugeneFlesselle added a commit to dotty-staging/dotty that referenced this pull request Jul 17, 2025
@EugeneFlesselle EugeneFlesselle marked this pull request as ready for review July 17, 2025 15:47
EugeneFlesselle added a commit to dotty-staging/dotty that referenced this pull request Jul 18, 2025
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@odersky odersky assigned EugeneFlesselle and unassigned odersky Sep 10, 2025
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for squeezing these changes in your busy schedule!

@odersky odersky merged commit 85ca5d1 into scala:main Sep 13, 2025
43 checks passed
@odersky odersky deleted the distributeAnd branch September 13, 2025 08:40
hamzaremmal added a commit that referenced this pull request Sep 13, 2025
#23920)

Reverts #23441

We cannot compile the bootstrapped stdlib after this change. We will
investigate more during next week and remerge it with a fix for that
works with the stdlib too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unsoundness with distribution of intersection over covariant types
2 participants