CapturingType

dotty.tools.dotc.cc.CapturingType$

A (possibly boxed) capturing type. This is internally represented as an annotated type with a @retains or @retainsByName annotation, but the extractor will succeed only at phase CheckCaptures. That way, we can ignore caturing information until phase CheckCaptures since it is wrapped in a plain annotation.

The same trick does not work for the boxing information. Boxing is context dependent, so we have to add that information in the Setup step preceding CheckCaptures. Boxes are added for all type arguments of methods. For type arguments of applied types a different strategy is used where we box arguments of applied types that are not functions when accessing the argument.

An alternative strategy would add boxes also to arguments of applied types during setup. But this would have to be done for all possibly accessibly types from the compiled units as well as their dependencies. It's difficult to do this in a DenotationTransformer without accidentally forcing symbol infos. That's why this alternative was not implemented. If we would go back on this it would make sense to also treat captuyring types different from annotations and to generate them all during Setup and in DenotationTransformers.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete methods

def apply(parent: Type, refs: CaptureSet, boxed: Boolean)(using Context): Type

Smart constructor that drops empty capture sets and fuses compatible capturiong types. An outer type capturing type A can be fused with an inner capturing type B if their boxing status is the same or if A is boxed.

Smart constructor that drops empty capture sets and fuses compatible capturiong types. An outer type capturing type A can be fused with an inner capturing type B if their boxing status is the same or if A is boxed.

Attributes

An extractor that succeeds only during CheckCapturingPhase. Boxing statis is returned separately by CaptureOps.isBoxed.

An extractor that succeeds only during CheckCapturingPhase. Boxing statis is returned separately by CaptureOps.isBoxed.

Attributes