@@ -720,7 +720,7 @@ class TypeComparer(initctx: Context) extends DotClass {
720
720
else isSubType(tp1, tp2) && isSubType(tp2, tp1)
721
721
722
722
/** The greatest lower bound of two types */
723
- def glb (tp1 : Type , tp2 : Type ): Type =
723
+ def glb (tp1 : Type , tp2 : Type ): Type = /* >|> */ ctx.traceIndented( s " glb( ${tp1.show} , ${tp2.show} ) " , typr, show = true ) /* <|< */ {
724
724
if (tp1 eq tp2) tp1
725
725
else if (! tp1.exists) tp2
726
726
else if (! tp2.exists) tp1
@@ -743,6 +743,7 @@ class TypeComparer(initctx: Context) extends DotClass {
743
743
}
744
744
}
745
745
}
746
+ }
746
747
747
748
/** The greatest lower bound of a list types */
748
749
final def glb (tps : List [Type ]): Type =
@@ -870,17 +871,10 @@ class TypeComparer(initctx: Context) extends DotClass {
870
871
871
872
/** Try to distribute `&` inside type, detect and handle conflicts */
872
873
private def distributeAnd (tp1 : Type , tp2 : Type ): Type = tp1 match {
873
- case tp1 @ TypeBounds (lo1, hi1) =>
874
+ case tp1 : TypeBounds =>
874
875
tp2 match {
875
- case tp2 @ TypeBounds (lo2, hi2) =>
876
- if ((lo1 eq hi1) && (lo2 eq hi2)) {
877
- val v = tp1 commonVariance tp2
878
- if (v > 0 ) return TypeAlias (hi1 & hi2, v)
879
- if (v < 0 ) return TypeAlias (lo1 | lo2, v)
880
- }
881
- TypeBounds (lo1 | lo2, hi1 & hi2)
882
- case _ =>
883
- andConflict(tp1, tp2)
876
+ case tp2 : TypeBounds => tp1 & tp2
877
+ case _ => andConflict(tp1, tp2)
884
878
}
885
879
case tp1 : ClassInfo =>
886
880
tp2 match {
@@ -944,17 +938,10 @@ class TypeComparer(initctx: Context) extends DotClass {
944
938
945
939
/** Try to distribute `|` inside type, detect and handle conflicts */
946
940
private def distributeOr (tp1 : Type , tp2 : Type ): Type = tp1 match {
947
- case tp1 @ TypeBounds (lo1, hi1) =>
941
+ case tp1 : TypeBounds =>
948
942
tp2 match {
949
- case tp2 @ TypeBounds (lo2, hi2) =>
950
- if ((lo1 eq hi1) && (lo2 eq hi2)) {
951
- val v = tp1 commonVariance tp2
952
- if (v > 0 ) return TypeAlias (hi1 | hi2, v)
953
- if (v < 0 ) return TypeAlias (lo1 & lo2, v)
954
- }
955
- TypeBounds (lo1 & lo2, hi1 | hi2)
956
- case _ =>
957
- orConflict(tp1, tp2)
943
+ case tp2 : TypeBounds => tp1 | tp2
944
+ case _ => orConflict(tp1, tp2)
958
945
}
959
946
case tp1 : ClassInfo =>
960
947
tp2 match {
0 commit comments