File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
compiler/src/dotty/tools/dotc/cc Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,8 @@ extension (tp: Type)
42
42
else CapturingType (parent, refs, tp.isBoxed)
43
43
44
44
def boxed (using Context ): Type = tp.dealias match
45
- case tp @ CapturingType (parent, refs) =>
46
- def boxedTp = parent.boxed match
47
- case CapturingType (parent1, refs1) =>
48
- CapturingType (parent1, refs ++ refs1, boxed = true )
49
- case parent1 =>
50
- CapturingType (parent1, refs, boxed = true )
51
- if tp.isBoxed || refs.isAlwaysEmpty then tp
52
- else tp.annot match
45
+ case tp @ CapturingType (parent, refs) if ! tp.isBoxed && ! refs.isAlwaysEmpty =>
46
+ tp.annot match
53
47
case ann : CaptureAnnotation =>
54
48
ann.boxedType(tp)
55
49
case ann =>
@@ -64,7 +58,6 @@ extension (tp: Type)
64
58
if ctx.phase != Phases .checkCapturesPhase || defn.isFunctionClass(tycon.typeSymbol)
65
59
then tp
66
60
else tp.boxed
67
- // .showing(i"boxedUF $tp in $tycon = $result")
68
61
69
62
/** The boxed capture set of a type */
70
63
def boxedCaptureSet (using Context ): CaptureSet =
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ object CapturingType:
14
14
if refs.isAlwaysEmpty then parent
15
15
else parent match
16
16
case parent @ CapturingType (parent1, refs1) if boxed || ! parent.isBoxed =>
17
+ // Fuse types except if nested type is boxed and current one isn't.
17
18
apply(parent1, refs ++ refs1, boxed)
18
19
case _ =>
19
20
AnnotatedType (parent, CaptureAnnotation (refs, boxed)(defn.RetainsAnnot ))
You can’t perform that action at this time.
0 commit comments