Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb1bb73

Browse files
chore: do not assume scala types as transparent, source should enforce it (#23105)
Follow-up of #23104 This is done in a separate PR as both PRs only share the parent commit of 2012. Working on these kinds of changes in the future would be easier when #23099 is merged.
2 parents 6c86743 + db6f86a commit eb1bb73

File tree

1 file changed

+4
-34
lines changed

1 file changed

+4
-34
lines changed

‎compiler/src/dotty/tools/dotc/core/Definitions.scala‎

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,12 @@ class Definitions {
279279
* To achieve this, we synthesize all Any and Object methods; Object methods no longer get
280280
* loaded from a classfile.
281281
*/
282-
@tu lazy val AnyClass: ClassSymbol = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.Any, Abstract, Nil), ensureCtor = false)
282+
@tu lazy val AnyClass: ClassSymbol = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.Any, Abstract|TransparentType, Nil), ensureCtor = false)
283283
def AnyType: TypeRef = AnyClass.typeRef
284-
@tu lazy val MatchableClass: ClassSymbol = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.Matchable, Trait, AnyType :: Nil), ensureCtor = false)
284+
@tu lazy val MatchableClass: ClassSymbol = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.Matchable, Trait|TransparentType, AnyType :: Nil), ensureCtor = false)
285285
def MatchableType: TypeRef = MatchableClass.typeRef
286286
@tu lazy val AnyValClass: ClassSymbol =
287-
val res = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.AnyVal, Abstract, List(AnyType, MatchableType)))
287+
val res = completeClass(enterCompleteClassSymbol(ScalaPackageClass, tpnme.AnyVal, Abstract|TransparentType, List(AnyType, MatchableType)))
288288
// Mark companion as absent, so that class does not get re-completed
289289
val companion = ScalaPackageVal.info.decl(nme.AnyVal).symbol
290290
companion.moduleClass.markAbsent()
@@ -2062,42 +2062,12 @@ class Definitions {
20622062
HasProblematicGetClass.contains(className)
20632063

20642064
@tu lazy val assumedTransparentNames: Map[Name, Set[Symbol]] =
2065-
// add these for now, until we had a chance to retrofit 2.13 stdlib
20662065
// we should do a more through sweep through it then.
20672066
val strs = Map(
2068-
"Any" -> Set("scala"),
2069-
"AnyVal" -> Set("scala"),
2070-
"Matchable" -> Set("scala"),
2071-
"Product" -> Set("scala"),
20722067
"Object" -> Set("java.lang"),
20732068
"Comparable" -> Set("java.lang"),
20742069
"Serializable" -> Set("java.io"),
2075-
"BitSetOps" -> Set("scala.collection"),
2076-
"IndexedSeqOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
2077-
"IterableOnceOps" -> Set("scala.collection"),
2078-
"IterableOps" -> Set("scala.collection"),
2079-
"LinearSeqOps" -> Set("scala.collection", "scala.collection.immutable"),
2080-
"MapOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
2081-
"SeqOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
2082-
"SetOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
2083-
"SortedMapOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
2084-
"SortedOps" -> Set("scala.collection"),
2085-
"SortedSetOps" -> Set("scala.collection", "scala.collection.mutable", "scala.collection.immutable"),
2086-
"StrictOptimizedIterableOps" -> Set("scala.collection"),
2087-
"StrictOptimizedLinearSeqOps" -> Set("scala.collection"),
2088-
"StrictOptimizedMapOps" -> Set("scala.collection", "scala.collection.immutable"),
2089-
"StrictOptimizedSeqOps" -> Set("scala.collection", "scala.collection.immutable"),
2090-
"StrictOptimizedSetOps" -> Set("scala.collection", "scala.collection.immutable"),
2091-
"StrictOptimizedSortedMapOps" -> Set("scala.collection", "scala.collection.immutable"),
2092-
"StrictOptimizedSortedSetOps" -> Set("scala.collection", "scala.collection.immutable"),
2093-
"ArrayDequeOps" -> Set("scala.collection.mutable"),
2094-
"DefaultSerializable" -> Set("scala.collection.generic"),
2095-
"IsIterable" -> Set("scala.collection.generic"),
2096-
"IsIterableLowPriority" -> Set("scala.collection.generic"),
2097-
"IsIterableOnce" -> Set("scala.collection.generic"),
2098-
"IsIterableOnceLowPriority" -> Set("scala.collection.generic"),
2099-
"IsMap" -> Set("scala.collection.generic"),
2100-
"IsSeq" -> Set("scala.collection.generic"))
2070+
)
21012071
strs.map { case (simple, pkgs) => (
21022072
simple.toTypeName,
21032073
pkgs.map(pkg => staticRef(pkg.toTermName, isPackage = true).symbol.moduleClass)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /