Skip to content

Commit e15d31c

Browse files
committed
Refactor and comment CheckCaptures
1 parent acf8286 commit e15d31c

File tree

3 files changed

+242
-163
lines changed

3 files changed

+242
-163
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ extension (sym: Symbol)
135135
sym == defn.Compiletime_erasedValue
136136
|| defn.isFunctionClass(sym.maybeOwner)
137137

138+
/** When applying `sym`, would the result type be unboxed?
139+
* This is the case if the result type contains a top-level reference to an enclosing
140+
* class or method type parameter and the method does not allow root capture.
141+
* If the type parameter is instantiated to a boxed type, that type would
142+
* have to be unboxed in the method's result.
143+
*/
138144
def unboxesResult(using Context): Boolean =
139145
def containsEnclTypeParam(tp: Type): Boolean = tp.strippedDealias match
140146
case tp @ TypeRef(pre: ThisType, _) => tp.symbol.is(Param)

0 commit comments

Comments
 (0)