Skip to content

Commit a89601a

Browse files
committed
Rename isFullyInitialized to isFullyFilled to avoid confusion
1 parent afed473 commit a89601a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,19 +494,17 @@ class Semantic {
494494

495495
// ----- Promotion ----------------------------------------------------
496496
extension (addr: Addr)
497-
/** Whether the object is fully initialized
497+
/** Whether the object is fully assigned
498498
*
499499
* It means all fields and outers are set. For performance, we don't check
500500
* outers here, because Scala semantics ensure that they are always set
501501
* before any user code in the constructor.
502502
*
503-
* The interesting case is the outers for traits. The compiler synthesizes
504-
* proxy accessors for the outers in the class that extends the trait. As
505-
* those outers must be stable values, they are initialized immediately
506-
* following class parameters and before super constructor calls and user
507-
* code in the class body.
503+
* Note that `isFullyFilled = true` does not mean we can use the
504+
* object freely, as it's fields or outers may still reach uninitialized
505+
* objects.
508506
*/
509-
def isFullyInitialized: Contextual[Boolean] = log("isFullyInitialized " + addr, printer) {
507+
def isFullyFilled: Contextual[Boolean] = log("isFullyFilled " + addr, printer) {
510508
val obj = heap(addr)
511509
addr.klass.baseClasses.forall { klass =>
512510
!klass.hasSource || {
@@ -525,7 +523,7 @@ class Semantic {
525523
def tryPromoteCurrentObject: Contextual[Boolean] = log("tryPromoteCurrentObject ", printer) {
526524
promoted.isCurrentObjectPromoted || {
527525
// If we have all fields initialized, then we can promote This to hot.
528-
thisRef.isFullyInitialized && {
526+
thisRef.isFullyFilled && {
529527
promoted.promoteCurrent(thisRef)
530528
true
531529
}
@@ -591,7 +589,7 @@ class Semantic {
591589
*/
592590
def tryPromote(msg: String, source: Tree): Contextual[List[Error]] = log("promote " + warm.show + ", promoted = " + promoted, printer) {
593591
val classRef = warm.klass.appliedRef
594-
if classRef.memberClasses.nonEmpty || !warm.isFullyInitialized then
592+
if classRef.memberClasses.nonEmpty || !warm.isFullyFilled then
595593
return PromoteError(msg, source, trace.toVector) :: Nil
596594

597595
val fields = classRef.fields

0 commit comments

Comments
 (0)