Dotty Documentation

0.5.0-bin-SNAPSHOT

class TyperState
extends DotClass with Showable

[-] Constructors

TyperState ( previous: TyperState )

[-] Members

[+] private var isCommitted : Boolean
[+] private var myConstraint : Constraint
[+] private var myEphemeral : Boolean
[+] private var myIsCommittable : Boolean
[+] private var myReporter : Reporter
[+] private val previousConstraint : Constraint
[+] private var testReporter : StoreReporter
[+] def commit ( ) ( implicit ctx: Context ) : Unit

Commit typer state so that its information is copied into current typer state In addition (1) the owning state of undetermined or temporarily instantiated type variables changes from this typer state to the current one. (2) Variables that were temporarily instantiated in the current typer state are permanently instantiated instead.

A note on merging: An interesting test case is isApplicableSafe.scala. It turns out that this requires a context merge using the new `&' operator. Sequence of actions: 1) Typecheck argument in typerstate 1. 2) Cache argument. 3) Evolve same typer state (to typecheck other arguments, say) leading to a different constraint. 4) Take typechecked argument in same state.

It turns out that the merge is needed not just for isApplicableSafe but also for (e.g. erased-lubs.scala) as well as many parts of dotty itself.

[+] def constraint : Constraint
[+] def constraint_= ( c: Constraint ) ( implicit ctx: Context ) : Unit
[+] def ephemeral : Boolean

The ephemeral flag is set as a side effect if an operation accesses the underlying type of a type variable. The reason we need this flag is that any such operation is not referentially transparent; it might logically change its value at the moment the type variable is instantiated. Caching code needs to check the ephemeral flag; If the flag is set during an operation, the result of that operation should not be cached.

[+] def ephemeral_= ( x: Boolean ) : Unit
[+] def fresh ( ) : TyperState

A fresh typer state with the same constraint as this one.

[+] def gc ( ) ( implicit ctx: Context ) : Unit

Make type variable instances permanent by assigning to inst field if type variable instantiation cannot be retracted anymore. Then, remove no-longer needed constraint entries.

[+] def hashesStr : String
[+] def instType ( tvar: TypeVar ) ( implicit ctx: Context ) : Type

Gives for each instantiated type var that does not yet have its inst field set, the instance value stored in the constraint. Storing instances in constraints is done only in a temporary way for contexts that may be retracted without also retracting the type var as a whole.

[+] def isCommittable : Boolean
[+] def isGlobalCommittable : Boolean
[+] def reporter : Reporter
[+] def setCommittable ( committable: Boolean ) : TyperState
[+] def setReporter ( reporter: Reporter ) : TyperState

A fresh type state with the same constraint as this one and the given reporter

[+] def test ( op: => T ) : T

Test using op, restoring typerState to previous state afterwards

[+] override def toText ( printer: Printer ) : Text

The text representation of this showable element. This normally dispatches to a pattern matching method in Printers.

[+] def uncommittedAncestor : TyperState

The closest ancestor of this typer state (including possibly this typer state itself) which is not yet committed, or which does not have a parent.

[+] def uninstVars : Seq [ TypeVar ]

The uninstantiated variables