Skip to content

Commit 363f8b6

Browse files
committed
Short circuit if we find a problematic promotion
1 parent 259a2ab commit 363f8b6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,12 @@ object Checking {
339339
buffer += Promote(potInner)(source)
340340
}
341341

342-
val errs = buffer.toList.flatMap(eff => check(eff))
343-
if errs.isEmpty then
344-
Errors.empty
345-
else
346-
UnsafePromotion(warm, eff.source, state.path, errs.toList).toErrors
342+
for (eff <- buffer.toList) {
343+
val err = check(eff)
344+
if !errs.isEmpty then
345+
return UnsafePromotion(warm, eff.source, state.path, errs.toList).toErrors
346+
}
347+
Errors.empty
347348

348349
private def checkPromote(eff: Promote)(using state: State): Errors =
349350
if (state.safePromoted.contains(eff.potential)) Errors.empty

0 commit comments

Comments
 (0)