@@ -518,8 +518,8 @@ object Denotations {
518
518
val info1 = denot1.info
519
519
val info2 = denot2.info
520
520
val sameSym = sym1 eq sym2
521
- if (sameSym && (info1 frozen_<:< info2)) denot2
522
- else if (sameSym && (info2 frozen_<:< info1)) denot1
521
+ if (sameSym && (info1.widenExpr frozen_<:< info2.widenExpr )) denot2
522
+ else if (sameSym && (info2.widenExpr frozen_<:< info1.widenExpr )) denot1
523
523
else {
524
524
val jointSym =
525
525
if (sameSym) sym1
@@ -586,9 +586,11 @@ object Denotations {
586
586
(for ((name1, name2, idx) <- (tp1.paramNames, tp2.paramNames, tp1.paramNames.indices).zipped)
587
587
yield if (name1 == name2) name1 else tp1.companion.syntheticParamName(idx)).toList
588
588
589
- /** Normally, `tp1 & tp2`. Special cases for matching methods and classes, with
590
- * the possibility of raising a merge error.
591
- */
589
+ /** Normally, `tp1 & tp2`.
590
+ * Special cases for matching methods and classes, with
591
+ * the possibility of raising a merge error.
592
+ * Special handling of ExprTypes, where mixed intersections widen the ExprType away.
593
+ */
592
594
def infoMeet (tp1 : Type , tp2 : Type , sym1 : Symbol , sym2 : Symbol , safeIntersection : Boolean )(implicit ctx : Context ): Type = {
593
595
if (tp1 eq tp2) tp1
594
596
else tp1 match {
@@ -645,9 +647,13 @@ object Denotations {
645
647
case _ =>
646
648
mergeConflict(sym1, sym2, tp1, tp2)
647
649
}
648
-
650
+ case ExprType (rtp1) =>
651
+ tp2 match {
652
+ case ExprType (rtp2) ExprType (rtp1 & rtp2)
653
+ case _ => rtp1 & tp2
654
+ }
649
655
case _ =>
650
- try tp1.widenExpr & tp2.widenExpr
656
+ try tp1 & tp2.widenExpr
651
657
catch {
652
658
case ex : Throwable =>
653
659
println(i " error for meet: $tp1 &&& $tp2, ${tp1.getClass}, ${tp2.getClass}" )
@@ -656,9 +662,11 @@ object Denotations {
656
662
}
657
663
}
658
664
659
- /** Normally, `tp1 | tp2`. Special cases for matching methods and classes, with
660
- * the possibility of raising a merge error.
661
- */
665
+ /** Normally, `tp1 | tp2`.
666
+ * Special cases for matching methods and classes, with
667
+ * the possibility of raising a merge error.
668
+ * Special handling of ExprTypes, where mixed unions widen the ExprType away.
669
+ */
662
670
def infoJoin (tp1 : Type , tp2 : Type , sym1 : Symbol , sym2 : Symbol )(implicit ctx : Context ): Type = tp1 match {
663
671
case tp1 : TypeBounds =>
664
672
tp2 match {
@@ -697,8 +705,13 @@ object Denotations {
697
705
case _ =>
698
706
mergeConflict(sym1, sym2, tp1, tp2)
699
707
}
708
+ case ExprType (rtp1) =>
709
+ tp2 match {
710
+ case ExprType (rtp2) => ExprType (rtp1 | rtp2)
711
+ case _ => rtp1 | tp2
712
+ }
700
713
case _ =>
701
- tp1 | tp2
714
+ tp1 | tp2.widenExpr
702
715
}
703
716
704
717
/** A non-overloaded denotation */
0 commit comments