From d4f30d1a268a51ee74c98f6ae0f45136274536af Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 26 Oct 2015 09:41:25 +0100 Subject: Keep separate chain of outer reporters for StoreReporters Used in rewritten `errorsReported` method. This fixes #866. The problem before was that `TyperState#trywithFallBack` temporarily updates the reporter, so crawling up the context chain to check for reporters with errors missed some reported errors, which triggered the assertion in `Tree#withType`. --- src/dotty/tools/dotc/core/TyperState.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dotty/tools/dotc/core/TyperState.scala') diff --git a/src/dotty/tools/dotc/core/TyperState.scala b/src/dotty/tools/dotc/core/TyperState.scala index 5617f568a..36f026107 100644 --- a/src/dotty/tools/dotc/core/TyperState.scala +++ b/src/dotty/tools/dotc/core/TyperState.scala @@ -98,7 +98,7 @@ extends TyperState(r) { override def fresh(isCommittable: Boolean): TyperState = - new MutableTyperState(this, new StoreReporter, isCommittable) + new MutableTyperState(this, new StoreReporter(reporter), isCommittable) override def withReporter(reporter: Reporter) = new MutableTyperState(this, reporter, isCommittable) @@ -169,7 +169,7 @@ extends TyperState(r) { * found a better solution. */ override def tryWithFallback[T](op: => T)(fallback: => T)(implicit ctx: Context): T = { - val storeReporter = new StoreReporter + val storeReporter = new StoreReporter(myReporter) val savedReporter = myReporter myReporter = storeReporter val savedConstraint = myConstraint -- cgit v1.2.3