aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TyperState.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/TyperState.scala')
-rw-r--r--src/dotty/tools/dotc/core/TyperState.scala11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala
index 4a1924909..69c35faf5 100644
--- a/src/dotty/tools/dotc/core/TyperState.scala
+++ b/src/dotty/tools/dotc/core/TyperState.scala
@@ -65,13 +65,12 @@ class TyperState(r: Reporter) extends DotClass with Showable {
/** Optionally, if this is a mutable typerstate, it's creator state */
def parent: Option[TyperState] = None
- /** The closest ancestor of this typer state (including possible this typer state itself)
- * which is not yet committed.
+ /** 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 uncommittedAncestor: TyperState = parent match {
- case Some(p) if p.isCommitted => p.uncommittedAncestor
- case _ => this
- }
+ def uncommittedAncestor: TyperState =
+ if (!isCommitted || !parent.isDefined) this
+ else parent.get.uncommittedAncestor
/** Make type variable instances permanent by assigning to `inst` field if
* type variable instantiation cannot be retracted anymore. Then, remove