Skip to content

Commit b6913e1

Browse files
committed
Don't iterate if errors found
1 parent 0f19e75 commit b6913e1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,15 @@ object Semantic {
781781
final def work()(using State, Context): Unit =
782782
pendingTasks match
783783
case task :: rest =>
784-
doTask(task)
784+
val res = doTask(task)
785+
res.errors.foreach(_.issue)
785786

786-
if cache.changed then
787-
// discard heap changes and copy cache.out to cache.in
788-
cache.update()
789-
else
787+
if res.errors.nonEmpty then
790788
pendingTasks = rest
791789
checkedTasks = checkedTasks + task
790+
else
791+
// discard heap changes and copy cache.out to cache.in
792+
cache.update()
792793

793794
work()
794795
case _ =>
@@ -797,7 +798,7 @@ object Semantic {
797798
*
798799
* This method should only be called from the work list scheduler.
799800
*/
800-
private def doTask(task: Task)(using State, Context): Unit = {
801+
private def doTask(task: Task)(using State, Context): Result = {
801802
val thisRef = task
802803
val tpl = thisRef.klass.defTree.asInstanceOf[TypeDef].rhs.asInstanceOf[Template]
803804

@@ -807,8 +808,7 @@ object Semantic {
807808
given Trace = Trace.empty
808809
given Env = Env(paramValues)
809810

810-
val res = init(tpl, thisRef, thisRef.klass)
811-
res.errors.foreach(_.issue)
811+
init(tpl, thisRef, thisRef.klass)
812812
}
813813
}
814814
inline def workList(using wl: WorkList): WorkList = wl

0 commit comments

Comments
 (0)