aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/TyperState.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-29 18:36:18 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-29 18:36:18 +0100
commit0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3 (patch)
tree497e40b6b4c6ee37f7a24259296a15d50371fd91 /src/dotty/tools/dotc/core/TyperState.scala
parent3f39cd8e15c321cf6ac97a0137087f7c2d69ce60 (diff)
downloaddotty-0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3.tar.gz
dotty-0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3.tar.bz2
dotty-0553f08eaeee1f9ac7ef6c28b341a92e0fb452e3.zip
Tightening of position handlng
1) endPos works now even for NoPosition. 2) On the other hand, there's an assertion in Typer.typed which requires every non-empty tree that's type checked in a globally committable context to have a defined position. Some fixes were needed to make the tests pass the new assert.
Diffstat (limited to 'src/dotty/tools/dotc/core/TyperState.scala')
-rw-r--r--src/dotty/tools/dotc/core/TyperState.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala
index f46c58c90..455320ba8 100644
--- a/src/dotty/tools/dotc/core/TyperState.scala
+++ b/src/dotty/tools/dotc/core/TyperState.scala
@@ -41,6 +41,9 @@ class TyperState(val reporter: Reporter) extends DotClass with Showable {
/** Is it allowed to commit this state? */
def isCommittable: Boolean = false
+ /** Can this state be transitively committed until the top-level? */
+ def isGlobalCommittable: Boolean = false
+
override def toText(printer: Printer): Text = "ImmutableTyperState"
}
@@ -55,6 +58,10 @@ extends TyperState(reporter) {
override def fresh(isCommittable: Boolean): TyperState =
new MutableTyperState(this, new StoreReporter, isCommittable)
+ override val isGlobalCommittable =
+ isCommittable &&
+ (!previous.isInstanceOf[MutableTyperState] || previous.isGlobalCommittable)
+
/** 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