Skip to content

Commit a475fa7

Browse files
committed
Rename TransparentTrait -> TransparentClass
1 parent d4d6aa2 commit a475fa7

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
@@ -552,7 +552,7 @@ trait ConstraintHandling {
552552

553553
private def isTransparent(tp: Type)(using Context): Boolean = tp match
554554
case AndType(tp1, tp2) => isTransparent(tp1) && isTransparent(tp2)
555-
case _ => tp.typeSymbol.isTransparentTrait && !tp.isLambdaSub
555+
case _ => tp.typeSymbol.isTransparentClass && !tp.isLambdaSub
556556

557557
/** If `tp` is an intersection such that some operands are transparent trait instances
558558
* and others are not, replace as many transparent trait instances as possible with Any
@@ -561,28 +561,28 @@ trait ConstraintHandling {
561561
* types (since in this case the type was not a true intersection of transparent traits
562562
* and other types to start with).
563563
*/
564-
def dropTransparentTraits(tp: Type, bound: Type)(using Context): Type =
564+
def dropTransparentClasses(tp: Type, bound: Type)(using Context): Type =
565565
var kept: Set[Type] = Set() // types to keep since otherwise bound would not fit
566566
var dropped: List[Type] = List() // the types dropped so far, last one on top
567567

568-
def dropOneTransparentTrait(tp: Type): Type =
568+
def dropOneTransparentClass(tp: Type): Type =
569569
val tpd = tp.dealias
570570
if isTransparent(tpd) && !kept.contains(tpd) then
571571
dropped = tpd :: dropped
572572
defn.AnyType
573573
else tpd match
574574
case AndType(tp1, tp2) =>
575-
val tp1w = dropOneTransparentTrait(tp1)
575+
val tp1w = dropOneTransparentClass(tp1)
576576
if tp1w ne tp1 then tp1w & tp2
577577
else
578-
val tp2w = dropOneTransparentTrait(tp2)
578+
val tp2w = dropOneTransparentClass(tp2)
579579
if tp2w ne tp2 then tp1 & tp2w
580580
else tpd
581581
case _ =>
582582
tp
583583

584584
def recur(tp: Type): Type =
585-
val tpw = dropOneTransparentTrait(tp)
585+
val tpw = dropOneTransparentClass(tp)
586586
if tpw eq tp then tp
587587
else if tpw <:< bound then recur(tpw)
588588
else
@@ -599,7 +599,7 @@ trait ConstraintHandling {
599599
tp
600600
else
601601
tpw
602-
end dropTransparentTraits
602+
end dropTransparentClasses
603603

604604
/** If `tp` is an applied match type alias which is also an unreducible application
605605
* of a higher-kinded type to a wildcard argument, widen to the match type's bound,
@@ -625,7 +625,7 @@ trait ConstraintHandling {
625625
* union type (except for unions | Null, which are kept in the state they were).
626626
* 3. Widen some irreducible applications of higher-kinded types to wildcard arguments
627627
* (see @widenIrreducible).
628-
* 4. Drop transparent traits from intersections (see @dropTransparentTraits).
628+
* 4. Drop transparent traits from intersections (see @dropTransparentClasses).
629629
*
630630
* Don't do these widenings if `bound` is a subtype of `scala.Singleton`.
631631
* Also, if the result of these widenings is a TypeRef to a module class,
@@ -659,7 +659,7 @@ trait ConstraintHandling {
659659
if (widenedFromUnion ne widenedFromSingle) && isTransparent(widenedFromUnion) then
660660
widenedFromSingle
661661
else
662-
dropTransparentTraits(widenedFromUnion, bound)
662+
dropTransparentClasses(widenedFromUnion, bound)
663663
widenIrreducible(widened)
664664

665665
wideInst match

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

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

1830-
@tu lazy val assumedTransparentTraits =
1830+
@tu lazy val assumedTransparentClasses =
18311831
Set[Symbol](ComparableClass, ProductClass, SerializableClass,
18321832
// add these for now, until we had a chance to retrofit 2.13 stdlib
18331833
// 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
@@ -1151,9 +1151,9 @@ object SymDenotations {
11511151
final def isEffectivelySealed(using Context): Boolean =
11521152
isOneOf(FinalOrSealed) || isClass && !isOneOf(EffectivelyOpenFlags)
11531153

1154-
final def isTransparentTrait(using Context): Boolean =
1154+
final def isTransparentClass(using Context): Boolean =
11551155
is(TransparentType)
1156-
|| defn.assumedTransparentTraits.contains(symbol)
1156+
|| defn.assumedTransparentClasses.contains(symbol)
11571157
|| isClass && hasAnnotation(defn.TransparentTraitAnnot)
11581158

11591159
/** 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
@@ -3007,8 +3007,8 @@ object TypeComparer {
30073007
def widenInferred(inst: Type, bound: Type, widenUnions: Boolean)(using Context): Type =
30083008
comparing(_.widenInferred(inst, bound, widenUnions))
30093009

3010-
def dropTransparentTraits(tp: Type, bound: Type)(using Context): Type =
3011-
comparing(_.dropTransparentTraits(tp, bound))
3010+
def dropTransparentClasses(tp: Type, bound: Type)(using Context): Type =
3011+
comparing(_.dropTransparentClasses(tp, bound))
30123012

30133013
def constrainPatternType(pat: Type, scrut: Type, forceInvariantRefinement: Boolean = false)(using Context): Boolean =
30143014
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
@@ -1211,7 +1211,7 @@ trait Applications extends Compatibility {
12111211
&& tree.tpe.classSymbol.isEnumCase
12121212
&& tree.tpe.widen.isValueType
12131213
then
1214-
val widened = TypeComparer.dropTransparentTraits(
1214+
val widened = TypeComparer.dropTransparentClasses(
12151215
tree.tpe.parents.reduceLeft(TypeComparer.andType(_, _)),
12161216
pt)
12171217
if widened <:< pt then Typed(tree, TypeTree(widened))
File renamed without changes.

0 commit comments

Comments
 (0)