Skip to content

Commit 4f488bf

Browse files
committed
Rename TransparentTrait -> TransparentClass
1 parent 0ae3f0c commit 4f488bf

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ trait ConstraintHandling {
449449

450450
private def isTransparent(tp: Type)(using Context): Boolean = tp match
451451
case AndType(tp1, tp2) => isTransparent(tp1) && isTransparent(tp2)
452-
case _ => tp.typeSymbol.isTransparentTrait && !tp.isLambdaSub
452+
case _ => tp.typeSymbol.isTransparentClass && !tp.isLambdaSub
453453

454454
/** If `tp` is an intersection such that some operands are transparent trait instances
455455
* and others are not, replace as many transparent trait instances as possible with Any
@@ -458,28 +458,28 @@ trait ConstraintHandling {
458458
* types (since in this case the type was not a true intersection of transparent traits
459459
* and other types to start with).
460460
*/
461-
def dropTransparentTraits(tp: Type, bound: Type)(using Context): Type =
461+
def dropTransparentClasses(tp: Type, bound: Type)(using Context): Type =
462462
var kept: Set[Type] = Set() // types to keep since otherwise bound would not fit
463463
var dropped: List[Type] = List() // the types dropped so far, last one on top
464464

465-
def dropOneTransparentTrait(tp: Type): Type =
465+
def dropOneTransparentClass(tp: Type): Type =
466466
val tpd = tp.dealias
467467
if isTransparent(tpd) && !kept.contains(tpd) then
468468
dropped = tpd :: dropped
469469
defn.AnyType
470470
else tpd match
471471
case AndType(tp1, tp2) =>
472-
val tp1w = dropOneTransparentTrait(tp1)
472+
val tp1w = dropOneTransparentClass(tp1)
473473
if tp1w ne tp1 then tp1w & tp2
474474
else
475-
val tp2w = dropOneTransparentTrait(tp2)
475+
val tp2w = dropOneTransparentClass(tp2)
476476
if tp2w ne tp2 then tp1 & tp2w
477477
else tpd
478478
case _ =>
479479
tp
480480

481481
def recur(tp: Type): Type =
482-
val tpw = dropOneTransparentTrait(tp)
482+
val tpw = dropOneTransparentClass(tp)
483483
if tpw eq tp then tp
484484
else if tpw <:< bound then recur(tpw)
485485
else
@@ -496,7 +496,7 @@ trait ConstraintHandling {
496496
tp
497497
else
498498
tpw
499-
end dropTransparentTraits
499+
end dropTransparentClasses
500500

501501
/** If `tp` is an applied match type alias which is also an unreducible application
502502
* of a higher-kinded type to a wildcard argument, widen to the match type's bound,
@@ -519,7 +519,7 @@ trait ConstraintHandling {
519519
* of all common base types, provided the result is a subtype of `bound`.
520520
* 3. Widen some irreducible applications of higher-kinded types to wildcard arguments
521521
* (see @widenIrreducible).
522-
* 4. Drop transparent traits from intersections (see @dropTransparentTraits).
522+
* 4. Drop transparent traits from intersections (see @dropTransparentClasses).
523523
*
524524
* Don't do these widenings if `bound` is a subtype of `scala.Singleton`.
525525
* Also, if the result of these widenings is a TypeRef to a module class,
@@ -551,7 +551,7 @@ trait ConstraintHandling {
551551
if (widenedFromUnion ne widenedFromSingle) && isTransparent(widenedFromUnion) then
552552
widenedFromSingle
553553
else
554-
dropTransparentTraits(widenedFromUnion, bound)
554+
dropTransparentClasses(widenedFromUnion, bound)
555555
widenIrreducible(widened)
556556

557557
wideInst match

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ class Definitions {
17611761
def isInfix(sym: Symbol)(using Context): Boolean =
17621762
(sym eq Object_eq) || (sym eq Object_ne)
17631763

1764-
@tu lazy val assumedTransparentTraits =
1764+
@tu lazy val assumedTransparentClasses =
17651765
Set[Symbol](ComparableClass, ProductClass, SerializableClass,
17661766
// add these for now, until we had a chance to retrofit 2.13 stdlib
17671767
// we should do a more through sweep through it then.

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,9 +1144,9 @@ object SymDenotations {
11441144
final def isEffectivelySealed(using Context): Boolean =
11451145
isOneOf(FinalOrSealed) || isClass && !isOneOf(EffectivelyOpenFlags)
11461146

1147-
final def isTransparentTrait(using Context): Boolean =
1147+
final def isTransparentClass(using Context): Boolean =
11481148
is(TransparentType)
1149-
|| defn.assumedTransparentTraits.contains(symbol)
1149+
|| defn.assumedTransparentClasses.contains(symbol)
11501150
|| isClass && hasAnnotation(defn.TransparentTraitAnnot)
11511151

11521152
/** The class containing this denotation which has the given effective name. */

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,8 +2875,8 @@ object TypeComparer {
28752875
def widenInferred(inst: Type, bound: Type)(using Context): Type =
28762876
comparing(_.widenInferred(inst, bound))
28772877

2878-
def dropTransparentTraits(tp: Type, bound: Type)(using Context): Type =
2879-
comparing(_.dropTransparentTraits(tp, bound))
2878+
def dropTransparentClasses(tp: Type, bound: Type)(using Context): Type =
2879+
comparing(_.dropTransparentClasses(tp, bound))
28802880

28812881
def constrainPatternType(pat: Type, scrut: Type, forceInvariantRefinement: Boolean = false)(using Context): Boolean =
28822882
comparing(_.constrainPatternType(pat, scrut, forceInvariantRefinement))

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ trait Applications extends Compatibility {
11811181
&& tree.tpe.classSymbol.isEnumCase
11821182
&& tree.tpe.widen.isValueType
11831183
then
1184-
val widened = TypeComparer.dropTransparentTraits(
1184+
val widened = TypeComparer.dropTransparentClasses(
11851185
tree.tpe.parents.reduceLeft(TypeComparer.andType(_, _)),
11861186
pt)
11871187
if widened <:< pt then Typed(tree, TypeTree(widened))
File renamed without changes.

0 commit comments

Comments
 (0)