CrossStageSafety

dotty.tools.dotc.staging.CrossStageSafety

Checks that staging level consistency holds and heals staged types .

Local term references are level consistent if and only if they are used at the same level as their definition.

Local type references can be used at the level of their definition or lower. If used used at a higher level, it will be healed if possible, otherwise it is inconsistent.

Type healing consists in transforming a level inconsistent type T into summon[Type[T]].Underlying.

As references to types do not necessarily have an associated tree it is not always possible to replace the types directly. Instead we always generate a type alias for it and place it at the start of the surrounding quote. This also avoids duplication. For example: '{ val x: List[T] = ListT () }

is transformed to

'{ type t$1 = summon[Type[T]].Underlying val x: List[t$1] = Listt$1; () }

Attributes

Graph
Supertypes
class TreeMap
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def transform(tree: Tree)(using Context): Tree

Attributes

Definition Classes

Inherited methods

protected def isInQuoteOrSplice: Boolean

If we are inside a quote or a splice

If we are inside a quote or a splice

Attributes

Inherited from:
TreeMapWithStages
def transform(trees: List[Tree])(using Context): List[Tree]

Attributes

Inherited from:
TreeMap
override def transformBlock(blk: Block)(using Context): Block

Attributes

Definition Classes
Inherited from:
TreeMapWithPreciseStatContexts

Attributes

Inherited from:
TreeMap

Attributes

Inherited from:
TreeMap
def transformSelf(vd: ValDef)(using Context): ValDef

Attributes

Inherited from:
TreeMapWithImplicits
final override def transformStats(trees: List[Tree], exprOwner: Symbol)(using Context): List[Tree]

Attributes

Definition Classes
Inherited from:
TreeMapWithPreciseStatContexts
def transformStats[T](trees: List[Tree], exprOwner: Symbol, wrapResult: List[Tree] => Context ?=> T)(using Context): T

Attributes

Inherited from:
TreeMapWithPreciseStatContexts
def transformSub[Tr <: Tree](trees: List[Tr])(using Context): List[Tr]

Attributes

Inherited from:
TreeMap
def transformSub[Tr <: Tree](tree: Tr)(using Context): Tr

Attributes

Inherited from:
TreeMap

Inherited fields

Attributes

Inherited from:
TreeMap