@@ -346,6 +346,40 @@ object Checking {
346
346
}
347
347
Errors .empty
348
348
349
+ // / Check the Promotion of a Warm object, according to "Rule 2":
350
+ //
351
+ // Rule 2: Promote(pot)
352
+ //
353
+ // for all concrete methods `m` of D
354
+ // pot.m!, Promote(pot.m)
355
+ //
356
+ // for all concrete fields `f` of D
357
+ // Promote(pot.f)
358
+ //
359
+ // for all inner classes `F` of D
360
+ // Warm[F, pot].init!, Promote(Warm[F, pot])
361
+ private def checkPromoteWarm (warm : Warm , eff : Effect )(using state : State ): Errors =
362
+ val Warm (cls, outer) = warm
363
+ // Errors.empty
364
+ val classRef = cls.info.asInstanceOf [ClassInfo ].appliedRef
365
+ // All members of class must be promotable.
366
+ val memberErrs = classRef.allMembers.flatMap { denot =>
367
+ val sym = denot.symbol
368
+ val summary = warm.toPots.select(sym, warm.source, true )
369
+ (summary.effs ++ summary.pots.map(Promote (_)(warm.source)).toList)
370
+ }.flatMap(check(_))
371
+
372
+ // All inner classes of classRef must be promotable.
373
+ // TODO: Implement this
374
+ val innerClassesErrs = Errors .empty
375
+
376
+ val errs = memberErrs ++ innerClassesErrs
377
+ if errs.isEmpty then {
378
+ Errors .empty
379
+ } else {
380
+ UnsafePromotion (warm, eff.source, state.path, errs.toList).toErrors
381
+ }
382
+
349
383
private def checkPromote (eff : Promote )(using state : State ): Errors =
350
384
if (state.safePromoted.contains(eff.potential)) Errors .empty
351
385
else {
0 commit comments