Skip to content
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

Fix calculation to drop transparent classes #16344

Merged
merged 3 commits into from
Nov 15, 2022
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Nov 15, 2022

Two fixes:

  1. Don't forget about refinements
  2. Don't dealias

Fixes #16342
Fixes #16338

The first fix is essential for #16342. The second fix is just to keep types tidy and not open aliases needlessly.

It probably fixes issues #16337 and #16336 as well, but the test cases were not self-contained, so I could not try them out. It might fix other recent regressions as well.

The previous incorrect version hid errors in previous regressions #15365 and #16311 which will need to be re-opened now.

Two fixes:

 1. Don't forget about refinements
 2. Don't dealias

Fixes scala#16342

The first fix is essential for $16342. The second fix is just to keep
types tidy and not open aliases needlessly.

The previous incorrect version hid errors in previous regressions scala#15365 and scala#16311
which will need to be re-opened now.
@odersky
Copy link
Contributor Author

odersky commented Nov 15, 2022

The problem here was that a case in the computation of dropTransparent was overlooked: In

   A { type T = B } & C

the computation would widen to C if A was a transparent class. So the alias { type T = B} was forgotten. Previously, that never showed up in our tests since transparent traits were rare. But now it does show up in several code bases, since Any counts as transparent.

Don't drop transparent classes. This means that a type such as
```
   Any { type T = A } & Object
```
will be kept as is. Previously it was reduced to `Any { type T = A }`
but that feels wrong.

Transparent classes now only enter the picture for typing union types. If the
join of a union types consists only of transparent traits or classes, keep it
instead of widening it.
@odersky odersky merged commit e587a81 into scala:main Nov 15, 2022
@odersky odersky deleted the fix-14342 branch November 15, 2022 14:01
@Kordyjan Kordyjan added this to the 3.3.0 milestone Aug 1, 2023
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.

Regression in plokhotnyuk/jsoniter-scala v2.17.9 Regression in sciss/kollflitz v0.2.4
3 participants