diff options
Diffstat (limited to 'src/dotty/tools/dotc/core/TyperState.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/TyperState.scala | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala index 8c742edab..fd8a534d4 100644 --- a/src/dotty/tools/dotc/core/TyperState.scala +++ b/src/dotty/tools/dotc/core/TyperState.scala @@ -23,6 +23,10 @@ class TyperState(r: Reporter) extends DotClass with Showable { /** The uninstantiated variables */ def uninstVars = constraint.uninstVars + /** The ephemeral flag */ + def ephemeral: Boolean = false + def ephemeral_=(x: Boolean): Unit = () + /** 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 @@ -76,6 +80,12 @@ extends TyperState(r) { override def constraint = myConstraint override def constraint_=(c: Constraint) = myConstraint = c + private var myEphemeral: Boolean = previous.ephemeral + + override def ephemeral = myEphemeral + override def ephemeral_=(x: Boolean): Unit = { myEphemeral = x } + + override def fresh(isCommittable: Boolean): TyperState = new MutableTyperState(this, new StoreReporter, isCommittable) @@ -96,11 +106,11 @@ extends TyperState(r) { val targetState = ctx.typerState assert(isCommittable) targetState.constraint = constraint - constraint foreachTypeVar { tvar => if (tvar.owningState eq this) tvar.owningState = targetState } + targetState.ephemeral = ephemeral targetState.gc() reporter.flush() } |