Skip to content

Fix #3383: Don't fail on unreported errors #3734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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