Skip to content

Replace erased class modifiers with Erased base traits #23447

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 26 commits into from
Jul 16, 2025

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 28, 2025

Based on #23419

Fixes #23406

@odersky odersky marked this pull request as draft June 28, 2025 18:48
@odersky odersky requested a review from EugeneFlesselle June 30, 2025 13:36
@odersky
Copy link
Contributor Author

odersky commented Jun 30, 2025

Doc pages are now updated to the new scheme. See c878878.

@odersky odersky marked this pull request as ready for review July 6, 2025 15:33
@odersky odersky force-pushed the change-erased-3 branch from c878878 to c43b83d Compare July 6, 2025 15:35
Copy link
Contributor

@EugeneFlesselle EugeneFlesselle left a comment

Choose a reason for hiding this comment

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

There are a lot of comments, but most of them are pretty minor.
The only really point is about erased lazy vals, which I don't think we can allow unless we check they can be evaluated.

@odersky odersky requested a review from a team as a code owner July 14, 2025 16:37
@hamzaremmal
Copy link
Member

@odersky On rebase, you should add file(s"${baseDirectory.value}/src/scala/compiletime/Erased.scala") to both lists for it to be included in the library:

Compile / sources := Seq(

Compile / sources := Seq(

odersky added 2 commits July 15, 2025 11:40
Since we will force erased expressions to be pure values, they are always
initialized.
odersky added 16 commits July 15, 2025 17:12
 - erasedValue[<ConstantType>] is now considered to be pure
 - calls of synthetic case class apply are considered pure if the case
   class is NoInits
 - Companions of Scala-2 classes Tuple and Some are assumed to be NoInits
Drop the previous convention that Singleton is an erased class under
x.modularity. That does not work anynmore if we change to the Erased trait
scheme.
Replace with test whether a type derivesFrom Erased.
We should never have flaky tests. Please, everyone adding new tests, watch out for this.
@odersky
Copy link
Contributor Author

odersky commented Jul 16, 2025

@EugeneFlesselle All green now.

Copy link
Contributor

@EugeneFlesselle EugeneFlesselle left a comment

Choose a reason for hiding this comment

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

LGTM!

@odersky odersky merged commit ce98496 into scala:main Jul 16, 2025
106 of 110 checks passed
@odersky odersky deleted the change-erased-3 branch July 16, 2025 20:59
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.

compiletime.erasedValue leaks to runtime
3 participants