Skip to content

Commit

Permalink
Merge pull request #3734 from dotty-staging/fix-#3383
Browse files Browse the repository at this point in the history
Fix #3383: Don't fail on unreported errors
  • Loading branch information
nicolasstucki committed Jan 3, 2018
2 parents ff4b19c + 8afd9b3 commit 22c0f91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ object Trees {
*/
def withType(tpe: Type)(implicit ctx: Context): ThisTree[Type] = {
if (tpe.isInstanceOf[ErrorType])
assert(ctx.mode.is(Mode.Interactive) || ctx.reporter.errorsReported)
assert(!Config.checkUnreportedErrors || ctx.reporter.errorsReported)
else if (Config.checkTreesConsistent)
checkChildrenTyped(productIterator)
withTypeUnchecked(tpe)
Expand Down
12 changes: 12 additions & 0 deletions compiler/src/dotty/tools/dotc/config/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ object Config {
*/
final val checkTypeRefCycles = false

/** If this flag is set, we check that types assigned to trees are error types only
* if some error was already reported. There are complicicated scenarios where this
* is not true. An example is TestNonCyclic in posTwice. If we remove the
* first (unused) import `import dotty.tools.dotc.core.Types.Type` in `CompilationUnit`,
* we end up assigning a CyclicReference error type to an import expression `annotation`
* before the cyclic reference is reported. What happens is that the error was reported
* as a result of a completion in a not-yet committed typerstate. So we cannot enforce
* this in all circumstances. But since it is almost always true it is useful to
* keep the Config option for debugging.
*/
final val checkUnreportedErrors = false

/** If this flag is set, it is checked that class type parameters are
* only references with NoPrefix or ThisTypes as prefixes. This option
* is usally disabled, because there are still some legitimate cases where
Expand Down

0 comments on commit 22c0f91

Please sign in to comment.