@@ -198,23 +198,26 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
198198
199199 def mergeRefinedOrApplied (tp1 : Type , tp2 : Type ): Type = {
200200 def fail = throw new AssertionError (i " Failure to join alternatives $tp1 and $tp2" )
201+ def fallback = tp2 match
202+ case AndType (tp21, tp22) =>
203+ mergeRefinedOrApplied(tp1, tp21) & mergeRefinedOrApplied(tp1, tp22)
204+ case _ =>
205+ fail
201206 tp1 match {
202207 case tp1 @ RefinedType (parent1, name1, rinfo1) =>
203208 tp2 match {
204209 case RefinedType (parent2, `name1`, rinfo2) =>
205210 tp1.derivedRefinedType(
206211 mergeRefinedOrApplied(parent1, parent2), name1, rinfo1 | rinfo2)
207- case _ => fail
212+ case _ => fallback
208213 }
209214 case tp1 @ AppliedType (tycon1, args1) =>
210215 tp2 match {
211216 case AppliedType (tycon2, args2) =>
212217 tp1.derivedAppliedType(
213218 mergeRefinedOrApplied(tycon1, tycon2),
214219 ctx.typeComparer.lubArgs(args1, args2, tycon1.typeParams))
215- case AndType (tp21, tp22) =>
216- mergeRefinedOrApplied(tp1, tp21) & mergeRefinedOrApplied(tp1, tp22)
217- case _ => fail
220+ case _ => fallback
218221 }
219222 case tp1 @ TypeRef (pre1, _) =>
220223 tp2 match {
0 commit comments