Skip to content

Commit 3d28731

Browse files
committed
Use hot instead of fully initialized
1 parent d7754d9 commit 3d28731

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ object Errors:
9797
case class UnsafePromotion(msg: String, trace: Seq[Tree], error: Error) extends Error:
9898
def show(using Context): String =
9999
msg + stacktrace() + "\n" +
100-
"Promoting the value to fully initialized failed due to the following problem:\n" +
100+
"Promoting the value to hot failed due to the following problem:\n" +
101101
error.show
102102

103103
/** Unsafe leaking a non-hot value as constructor arguments
@@ -129,5 +129,5 @@ object Errors:
129129
acc + text2
130130
}
131131
val verb = if multiple then " are " else " is "
132-
val adjective = "not fully initialized."
132+
val adjective = "not hot."
133133
subject + verb + adjective

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ object Semantic:
10831083
eval(body, thisV, klass)
10841084
}
10851085
given Trace = Trace.empty.add(body)
1086-
res.promote("The function return value is not fully initialized. Found = " + res.show + ". ")
1086+
res.promote("The function return value is not hot. Found = " + res.show + ". ")
10871087
}
10881088
if errors.nonEmpty then
10891089
reporter.report(UnsafePromotion(msg, trace.toVector, errors.head))
@@ -1127,12 +1127,12 @@ object Semantic:
11271127
withTrace(Trace.empty) {
11281128
val args = member.info.paramInfoss.flatten.map(_ => ArgInfo(Hot, Trace.empty))
11291129
val res = warm.call(member, args, receiver = NoType, superType = NoType)
1130-
res.promote("Cannot prove that the return value of " + member.show + " is fully initialized. Found = " + res.show + ". ")
1130+
res.promote("Cannot prove that the return value of " + member.show + " is hot. Found = " + res.show + ". ")
11311131
}
11321132
else
11331133
withTrace(Trace.empty) {
11341134
val res = warm.select(member)
1135-
res.promote("Cannot prove that the field " + member.show + " is fully initialized. Found = " + res.show + ". ")
1135+
res.promote("Cannot prove that the field " + member.show + " is hot. Found = " + res.show + ". ")
11361136
}
11371137
end for
11381138
end for
@@ -1233,7 +1233,7 @@ object Semantic:
12331233
/** Utility definition used for better error-reporting of argument errors */
12341234
case class ArgInfo(value: Value, trace: Trace):
12351235
def promote: Contextual[Unit] = withTrace(trace) {
1236-
value.promote("Cannot prove the method argument is fully initialized. Only fully initialized values are safe to leak.\nFound = " + value.show + ". ")
1236+
value.promote("Cannot prove the method argument is hot. Only hot values are safe to leak.\nFound = " + value.show + ". ")
12371237
}
12381238

12391239
/** Evaluate an expression with the given value for `this` in a given class `klass`
@@ -1370,12 +1370,12 @@ object Semantic:
13701370
eval(qual, thisV, klass)
13711371
val res = eval(rhs, thisV, klass)
13721372
extendTrace(expr) {
1373-
res.ensureHot("The RHS of reassignment must be fully initialized. Found = " + res.show + ". ")
1373+
res.ensureHot("The RHS of reassignment must be hot. Found = " + res.show + ". ")
13741374
}
13751375
case id: Ident =>
13761376
val res = eval(rhs, thisV, klass)
13771377
extendTrace(expr) {
1378-
res.ensureHot("The RHS of reassignment must be fully initialized. Found = " + res.show + ". ")
1378+
res.ensureHot("The RHS of reassignment must be hot. Found = " + res.show + ". ")
13791379
}
13801380

13811381
case closureDef(ddef) =>
@@ -1398,14 +1398,14 @@ object Semantic:
13981398
case Match(selector, cases) =>
13991399
val res = eval(selector, thisV, klass)
14001400
extendTrace(selector) {
1401-
res.ensureHot("The value to be matched needs to be fully initialized. Found = " + res.show + ". ")
1401+
res.ensureHot("The value to be matched needs to be hot. Found = " + res.show + ". ")
14021402
}
14031403
eval(cases.map(_.body), thisV, klass).join
14041404

14051405
case Return(expr, from) =>
14061406
val res = eval(expr, thisV, klass)
14071407
extendTrace(expr) {
1408-
res.ensureHot("return expression must be fully initialized. Found = " + res.show + ". ")
1408+
res.ensureHot("return expression must be hot. Found = " + res.show + ". ")
14091409
}
14101410

14111411
case WhileDo(cond, body) =>

0 commit comments

Comments
 (0)