We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
distributeAnd
1 parent 816bd5e commit 7f20c7fCopy full SHA for 7f20c7f
compiler/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -2610,10 +2610,12 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2610
case tp1: TypeVar if tp1.isInstantiated =>
2611
tp1.underlying & tp2
2612
case CapturingType(parent1, refs1) =>
2613
- if subCaptures(tp2.captureSet, refs1, frozen = true).isOK
+ val refs2 = tp2.captureSet
2614
+ if subCaptures(refs2, refs1, frozen = true).isOK
2615
&& tp1.isBoxedCapturing == tp2.isBoxedCapturing
2616
then
- parent1 & tp2
2617
+ if refs2.isAlwaysEmpty then parent1 & tp2
2618
+ else (parent1 & tp2).capturing(refs2)
2619
else
2620
tp1.derivedCapturingType(parent1 & tp2, refs1)
2621
case tp1: AnnotatedType if !tp1.isRefining =>
0 commit comments