dotty.tools.dotc.staging

Members list

Type members

Classlikes

Checks that staging level consistency holds and heals staged types.

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.

Healing a type consists in replacing locally defined types defined at staging level 0 and used in higher levels. For each type local T that is defined at level 0 and used in a quote, we summon a tag t: Type[T]. This t tag must be defined at level 0. The tags will be listed in the tags of the level 0 quote ('<t>{ ... }) and each reference to T will be replaced by t.Underlying in the body of the quote.

We delay the healing of types in quotes at level 1 or higher until those quotes reach level 0. At this point more types will be statically known and fewer types will need to be healed. This also keeps the nested quotes in their original form, we do not want macro users to see any artifacts of this phase in quoted expressions they might inspect.

Type heal example:

'{ val x: List[T] = ListT '{ .. T .. } () }

is transformed to

' { // where t is a given term of type Type[T] val x: List[t.Underlying] = List t.Underlying; '{ .. t.Underlying .. } () }

Attributes

Supertypes
class TreeMap
class Object
trait Matchable
class Any
Show all
class HealType(pos: SrcPos)(using x$2: Context) extends TypeMap

Attributes

Supertypes
class TypeMap
trait Type => Type
class Object
trait Matchable
class Any
Show all
object QuoteTypeTags

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object StagingLevel

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
abstract class TreeMapWithStages extends TreeMapWithImplicits

TreeMap that keeps track of staging levels using StagingLevel.

TreeMap that keeps track of staging levels using StagingLevel.

Attributes

Supertypes
class TreeMap
class Object
trait Matchable
class Any
Show all
Known subtypes