Skip to content

Commit 0b0e616

Browse files
author
Sebastian Nadorp
committed
Only expand the tree if no errors are reported.
1 parent 98f2460 commit 0b0e616

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

compiler/src/dotty/tools/dotc/ast/DesugarEnums.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ object DesugarEnums {
6464
}
6565

6666
/** A type tree referring to `enumClass` */
67-
def enumClassRef(implicit ctx: Context) =
68-
if (enumClass.exists) TypeTree(enumClass.typeRef) else TypeTree()
67+
def enumClassRef(implicit ctx: Context) = TypeTree(enumClass.typeRef)
6968

7069
/** Add implied flags to an enum class or an enum case */
7170
def addEnumFlags(cdef: TypeDef)(implicit ctx: Context) =

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ class Namer { typer: Typer =>
415415

416416
/** Expand tree and store in `expandedTree` */
417417
def expand(tree: Tree)(implicit ctx: Context): Unit = tree match {
418-
case mdef: DefTree =>
418+
case mdef: DefTree if !ctx.reporter.hasErrors =>
419419
val expanded = desugar.defTree(mdef)
420420
typr.println(i"Expansion: $mdef expands to $expanded")
421421
if (expanded ne mdef) mdef.pushAttachment(ExpandedTree, expanded)

0 commit comments

Comments
 (0)