@@ -449,7 +449,7 @@ trait ConstraintHandling {
449
449
450
450
private def isTransparent (tp : Type )(using Context ): Boolean = tp match
451
451
case AndType (tp1, tp2) => isTransparent(tp1) && isTransparent(tp2)
452
- case _ => tp.typeSymbol.isTransparentTrait && ! tp.isLambdaSub
452
+ case _ => tp.typeSymbol.isTransparentClass && ! tp.isLambdaSub
453
453
454
454
/** If `tp` is an intersection such that some operands are transparent trait instances
455
455
* and others are not, replace as many transparent trait instances as possible with Any
@@ -458,28 +458,28 @@ trait ConstraintHandling {
458
458
* types (since in this case the type was not a true intersection of transparent traits
459
459
* and other types to start with).
460
460
*/
461
- def dropTransparentTraits (tp : Type , bound : Type )(using Context ): Type =
461
+ def dropTransparentClasses (tp : Type , bound : Type )(using Context ): Type =
462
462
var kept : Set [Type ] = Set () // types to keep since otherwise bound would not fit
463
463
var dropped : List [Type ] = List () // the types dropped so far, last one on top
464
464
465
- def dropOneTransparentTrait (tp : Type ): Type =
465
+ def dropOneTransparentClass (tp : Type ): Type =
466
466
val tpd = tp.dealias
467
467
if isTransparent(tpd) && ! kept.contains(tpd) then
468
468
dropped = tpd :: dropped
469
469
defn.AnyType
470
470
else tpd match
471
471
case AndType (tp1, tp2) =>
472
- val tp1w = dropOneTransparentTrait (tp1)
472
+ val tp1w = dropOneTransparentClass (tp1)
473
473
if tp1w ne tp1 then tp1w & tp2
474
474
else
475
- val tp2w = dropOneTransparentTrait (tp2)
475
+ val tp2w = dropOneTransparentClass (tp2)
476
476
if tp2w ne tp2 then tp1 & tp2w
477
477
else tpd
478
478
case _ =>
479
479
tp
480
480
481
481
def recur (tp : Type ): Type =
482
- val tpw = dropOneTransparentTrait (tp)
482
+ val tpw = dropOneTransparentClass (tp)
483
483
if tpw eq tp then tp
484
484
else if tpw <:< bound then recur(tpw)
485
485
else
@@ -496,7 +496,7 @@ trait ConstraintHandling {
496
496
tp
497
497
else
498
498
tpw
499
- end dropTransparentTraits
499
+ end dropTransparentClasses
500
500
501
501
/** If `tp` is an applied match type alias which is also an unreducible application
502
502
* of a higher-kinded type to a wildcard argument, widen to the match type's bound,
@@ -519,7 +519,7 @@ trait ConstraintHandling {
519
519
* of all common base types, provided the result is a subtype of `bound`.
520
520
* 3. Widen some irreducible applications of higher-kinded types to wildcard arguments
521
521
* (see @widenIrreducible).
522
- * 4. Drop transparent traits from intersections (see @dropTransparentTraits ).
522
+ * 4. Drop transparent traits from intersections (see @dropTransparentClasses ).
523
523
*
524
524
* Don't do these widenings if `bound` is a subtype of `scala.Singleton`.
525
525
* Also, if the result of these widenings is a TypeRef to a module class,
@@ -551,7 +551,7 @@ trait ConstraintHandling {
551
551
if (widenedFromUnion ne widenedFromSingle) && isTransparent(widenedFromUnion) then
552
552
widenedFromSingle
553
553
else
554
- dropTransparentTraits (widenedFromUnion, bound)
554
+ dropTransparentClasses (widenedFromUnion, bound)
555
555
widenIrreducible(widened)
556
556
557
557
wideInst match
0 commit comments