File tree 2 files changed +3
-6
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -2613,11 +2613,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
2613
2613
val refs2 = tp2.captureSet
2614
2614
if subCaptures(refs2, refs1, frozen = true ).isOK
2615
2615
&& tp1.isBoxedCapturing == tp2.isBoxedCapturing
2616
- then
2617
- if refs2.isAlwaysEmpty then parent1 & tp2
2618
- else (parent1 & tp2).capturing(refs2)
2619
- else
2620
- tp1.derivedCapturingType(parent1 & tp2, refs1)
2616
+ then (parent1 & tp2).capturing(refs2)
2617
+ else tp1.derivedCapturingType(parent1 & tp2, refs1)
2621
2618
case tp1 : AnnotatedType if ! tp1.isRefining =>
2622
2619
tp1.underlying & tp2
2623
2620
case _ =>
Original file line number Diff line number Diff line change @@ -1940,7 +1940,7 @@ object Types {
1940
1940
* the two capture sets are combined.
1941
1941
*/
1942
1942
def capturing (cs : CaptureSet )(using Context ): Type =
1943
- if cs.isConst && cs.subCaptures(captureSet, frozen = true ).isOK then this
1943
+ if cs.isAlwaysEmpty || cs. isConst && cs.subCaptures(captureSet, frozen = true ).isOK then this
1944
1944
else this match
1945
1945
case CapturingType (parent, cs1) => parent.capturing(cs1 ++ cs)
1946
1946
case _ => CapturingType (this , cs)
You can’t perform that action at this time.
0 commit comments