@@ -198,23 +198,26 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
198
198
199
199
def mergeRefinedOrApplied (tp1 : Type , tp2 : Type ): Type = {
200
200
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
201
206
tp1 match {
202
207
case tp1 @ RefinedType (parent1, name1, rinfo1) =>
203
208
tp2 match {
204
209
case RefinedType (parent2, `name1`, rinfo2) =>
205
210
tp1.derivedRefinedType(
206
211
mergeRefinedOrApplied(parent1, parent2), name1, rinfo1 | rinfo2)
207
- case _ => fail
212
+ case _ => fallback
208
213
}
209
214
case tp1 @ AppliedType (tycon1, args1) =>
210
215
tp2 match {
211
216
case AppliedType (tycon2, args2) =>
212
217
tp1.derivedAppliedType(
213
218
mergeRefinedOrApplied(tycon1, tycon2),
214
219
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
218
221
}
219
222
case tp1 @ TypeRef (pre1, _) =>
220
223
tp2 match {
0 commit comments