Skip to content

chore: add transparent modifier to already assumed transparent types #23104

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 1 commit into from
Jul 15, 2025

Conversation

hamzaremmal
Copy link
Member

dotc already assumes that some of the types in stdlib are transparent. We now drop the assumption and add the transparent modifier to the source.

For reference, the list of assumed transparent types:

@tu lazy val assumedTransparentNames: Map[Name, Set[Symbol]] =
// add these for now, until we had a chance to retrofit 2.13 stdlib
// we should do a more through sweep through it then.
val strs = Map(
"Any" -> Set("scala"),
"AnyVal" -> Set("scala"),
"Matchable" -> Set("scala"),
"Product" -> Set("scala"),
"Object" -> Set("java.lang"),
"Comparable" -> Set("java.lang"),
"Serializable" -> Set("java.io"),
"BitSetOps" -> Set("scala.collection"),
"IndexedSeqOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
"IterableOnceOps" -> Set("scala.collection"),
"IterableOps" -> Set("scala.collection"),
"LinearSeqOps" -> Set("scala.collection", "scala.collection.immutable"),
"MapOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
"SeqOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
"SetOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
"SortedMapOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
"SortedOps" -> Set("scala.collection"),
"SortedSetOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
"StrictOptimizedIterableOps" -> Set("scala.collection"),
"StrictOptimizedLinearSeqOps" -> Set("scala.collection"),
"StrictOptimizedMapOps" -> Set("scala.collection", "scala.collection.immutable"),
"StrictOptimizedSeqOps" -> Set("scala.collection", "scala.collection.immutable"),
"StrictOptimizedSetOps" -> Set("scala.collection", "scala.collection.immutable"),
"StrictOptimizedSortedMapOps" -> Set("scala.collection", "scala.collection.immutable"),
"StrictOptimizedSortedSetOps" -> Set("scala.collection", "scala.collection.immutable"),
"ArrayDequeOps" -> Set("scala.collection.mutable"),
"DefaultSerializable" -> Set("scala.collection.generic"),
"IsIterable" -> Set("scala.collection.generic"),
"IsIterableLowPriority" -> Set("scala.collection.generic"),
"IsIterableOnce" -> Set("scala.collection.generic"),
"IsIterableOnceLowPriority" -> Set("scala.collection.generic"),
"IsMap" -> Set("scala.collection.generic"),
"IsSeq" -> Set("scala.collection.generic"))
strs.map { case (simple, pkgs) => (
simple.toTypeName,
pkgs.map(pkg => staticRef(pkg.toTermName, isPackage = true).symbol.moduleClass)
)
}

@hamzaremmal hamzaremmal added this to the 3.8.0 milestone May 5, 2025
@hamzaremmal hamzaremmal requested review from sjrd and natsukagami May 5, 2025 17:03
@hamzaremmal hamzaremmal self-assigned this May 5, 2025
@hamzaremmal hamzaremmal changed the title chore: add transparent modifer to already assumed transparent types chore: add transparent modifier to already assumed transparent types May 5, 2025
Copy link
Contributor

@natsukagami natsukagami left a comment

Choose a reason for hiding this comment

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

Checked to have all removed instances in #23105

@hamzaremmal hamzaremmal deleted the branch scala:main May 20, 2025 09:13
@hamzaremmal hamzaremmal reopened this May 20, 2025
@hamzaremmal hamzaremmal deleted the branch scala:main July 15, 2025 10:02
@hamzaremmal
Copy link
Member Author

Ugh, I should have changed the target of this PR before merging the stdlib...
I think recreating branch with the same name and then changing the target would work.

@hamzaremmal hamzaremmal reopened this Jul 15, 2025
@hamzaremmal hamzaremmal changed the base branch from embed-stdlib to main July 15, 2025 11:27
@hamzaremmal hamzaremmal marked this pull request as ready for review July 15, 2025 11:28
@hamzaremmal hamzaremmal requested a review from a team as a code owner July 15, 2025 11:28
@hamzaremmal hamzaremmal enabled auto-merge July 15, 2025 11:29
@hamzaremmal hamzaremmal merged commit 84c7e44 into scala:main Jul 15, 2025
29 checks passed
@hamzaremmal hamzaremmal deleted the add-transparent-modifier branch July 15, 2025 14:25
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.

2 participants