@@ -339,39 +339,39 @@ object Checking {
339
339
if (state.safePromoted.contains(eff.potential)) Errors .empty
340
340
else {
341
341
val pot = eff.potential
342
- val errs = pot match {
343
- case pot if canDirectlyPromote(pot) =>
342
+ val errs =
343
+ if canDirectlyPromote(pot) then
344
344
Errors .empty
345
+ else pot match {
346
+ case pot : ThisRef =>
347
+ PromoteThis (pot, eff.source, state.path).toErrors
345
348
346
- case pot : ThisRef =>
347
- PromoteThis (pot, eff.source, state.path).toErrors
348
-
349
- case _ : Cold =>
350
- PromoteCold (eff.source, state.path).toErrors
349
+ case _ : Cold =>
350
+ PromoteCold (eff.source, state.path).toErrors
351
351
352
- case pot @ Warm (cls, outer) =>
353
- checkPromoteWarm(pot, eff)
352
+ case pot @ Warm (cls, outer) =>
353
+ checkPromoteWarm(pot, eff)
354
354
355
- case Fun (pots, effs) =>
356
- val errs1 = state.test {
357
- effs.toList.flatMap(check(_))
358
- }
359
- val errs2 = state.test {
360
- pots.toList.flatMap { pot =>
361
- checkPromote(Promote (pot)(eff.source))
355
+ case Fun (pots, effs) =>
356
+ val errs1 = state.test {
357
+ effs.toList.flatMap(check(_))
358
+ }
359
+ val errs2 = state.test {
360
+ pots.toList.flatMap { pot =>
361
+ checkPromote(Promote (pot)(eff.source))
362
+ }
362
363
}
363
- }
364
364
365
- if (errs1.nonEmpty || errs2.nonEmpty)
366
- UnsafePromotion (pot, eff.source, state.path, errs1 ++ errs2).toErrors
367
- else
368
- Errors .empty
365
+ if (errs1.nonEmpty || errs2.nonEmpty)
366
+ UnsafePromotion (pot, eff.source, state.path, errs1 ++ errs2).toErrors
367
+ else
368
+ Errors .empty
369
369
370
- case pot =>
371
- val Summary (pots, effs) = expand(pot)
372
- val effs2 = pots.map(Promote (_)(eff.source))
373
- (effs2 ++ effs).toList.flatMap(check(_))
374
- }
370
+ case pot =>
371
+ val Summary (pots, effs) = expand(pot)
372
+ val effs2 = pots.map(Promote (_)(eff.source))
373
+ (effs2 ++ effs).toList.flatMap(check(_))
374
+ }
375
375
// If we can safely promote, then we don't need to check again
376
376
if (errs.isEmpty)
377
377
state.safePromoted += pot
0 commit comments