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