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 6929e77 commit b646a27Copy full SHA for b646a27
compiler/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -2618,10 +2618,12 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2618
case tp1: TypeVar if tp1.isInstantiated =>
2619
tp1.underlying & tp2
2620
case CapturingType(parent1, refs1) =>
2621
- if subCaptures(tp2.captureSet, refs1, frozen = true).isOK
+ val refs2 = tp2.captureSet
2622
+ if subCaptures(refs2, refs1, frozen = true).isOK
2623
&& tp1.isBoxedCapturing == tp2.isBoxedCapturing
2624
then
- parent1 & tp2
2625
+ if refs2.isAlwaysEmpty then parent1 & tp2
2626
+ else (parent1 & tp2).capturing(refs2)
2627
else
2628
tp1.derivedCapturingType(parent1 & tp2, refs1)
2629
case tp1: AnnotatedType if !tp1.isRefining =>
0 commit comments