File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -2090,8 +2090,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2090
2090
if (tp1 eq tp2) tp1
2091
2091
else if (! tp1.exists) tp1
2092
2092
else if (! tp2.exists) tp2
2093
- else if tp1.isAny && ! tp2.isLambdaSub || tp1.isAnyKind || isBottom(tp2) then tp1
2094
- else if tp2.isAny && ! tp1.isLambdaSub || tp2.isAnyKind || isBottom(tp1) then tp2
2093
+ else if tp1.isAny && ! tp2.isLambdaSub && tp2.noCaptures || tp1.isAnyKind || isBottom(tp2) then tp1
2094
+ else if tp2.isAny && ! tp1.isLambdaSub && tp1.noCaptures || tp2.isAnyKind || isBottom(tp1) then tp2
2095
2095
else
2096
2096
def mergedLub (tp1 : Type , tp2 : Type ): Type = {
2097
2097
tp1.atoms match
Original file line number Diff line number Diff line change @@ -266,15 +266,23 @@ object TypeOps:
266
266
case _ => false
267
267
}
268
268
269
- // Step 1: Get RecTypes and ErrorTypes out of the way,
269
+ // Step 1: Get RecTypes and ErrorTypes and CapturingTypes out of the way,
270
270
tp1 match {
271
- case tp1 : RecType => return tp1.rebind(approximateOr(tp1.parent, tp2))
272
- case err : ErrorType => return err
271
+ case tp1 : RecType =>
272
+ return tp1.rebind(approximateOr(tp1.parent, tp2))
273
+ case tp1 : CapturingType =>
274
+ return tp1.derivedCapturingType(approximateOr(tp1.parent, tp2), tp1.ref)
275
+ case err : ErrorType =>
276
+ return err
273
277
case _ =>
274
278
}
275
279
tp2 match {
276
- case tp2 : RecType => return tp2.rebind(approximateOr(tp1, tp2.parent))
277
- case err : ErrorType => return err
280
+ case tp2 : RecType =>
281
+ return tp2.rebind(approximateOr(tp1, tp2.parent))
282
+ case tp2 : CapturingType =>
283
+ return tp2.derivedCapturingType(approximateOr(tp1, tp2.parent), tp2.ref)
284
+ case err : ErrorType =>
285
+ return err
278
286
case _ =>
279
287
}
280
288
You can’t perform that action at this time.
0 commit comments