@@ -56,7 +56,8 @@ object Semantic:
56
56
case ThisRef (klass) =>
57
57
" ThisRef[" + klass.show + " ]"
58
58
case Warm (klass, outer, ctor, args) =>
59
- " Warm[" + klass.show + " ] { outer = " + outer.show + " , args = " + args.map(_.show).mkString(" (" , " , " , " )" ) + " }"
59
+ val argsText = if args.nonEmpty then " , args = " + args.map(_.show).mkString(" (" , " , " , " )" ) else " "
60
+ " Warm[" + klass.show + " ] { outer = " + outer.show + argsText + " }"
60
61
case Fun (expr, thisV, klass) =>
61
62
" Fun { this = " + thisV.show + " , owner = " + klass.show + " }"
62
63
case RefSet (values) =>
@@ -1080,7 +1081,7 @@ object Semantic:
1080
1081
eval(body, thisV, klass)
1081
1082
}
1082
1083
given Trace = Trace .empty.add(body)
1083
- res.promote(" The function return value is not fully initialized." )
1084
+ res.promote(" The function return value is not fully initialized. Found = " + res.show + " . " )
1084
1085
}
1085
1086
if errors.nonEmpty then
1086
1087
reporter.report(UnsafePromotion (msg, trace.toVector, errors.head))
@@ -1124,12 +1125,12 @@ object Semantic:
1124
1125
withTrace(Trace .empty) {
1125
1126
val args = member.info.paramInfoss.flatten.map(_ => ArgInfo (Hot , Trace .empty))
1126
1127
val res = warm.call(member, args, receiver = NoType , superType = NoType )
1127
- res.promote(" Cannot prove that the return value of " + member + " is fully initialized." )
1128
+ res.promote(" Cannot prove that the return value of " + member.show + " is fully initialized. Found = " + res.show + " . " )
1128
1129
}
1129
1130
else
1130
1131
withTrace(Trace .empty) {
1131
1132
val res = warm.select(member)
1132
- res.promote(" Cannot prove that the field " + member + " is fully initialized." )
1133
+ res.promote(" Cannot prove that the field " + member.show + " is fully initialized. Found = " + res.show + " . " )
1133
1134
}
1134
1135
end for
1135
1136
end for
@@ -1230,7 +1231,7 @@ object Semantic:
1230
1231
/** Utility definition used for better error-reporting of argument errors */
1231
1232
case class ArgInfo (value : Value , trace : Trace ):
1232
1233
def promote : Contextual [Unit ] = withTrace(trace) {
1233
- value.promote(" Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak." )
1234
+ value.promote(" Cannot prove the argument is fully initialized. Only fully initialized values are safe to leak. \n Found = " + value.show + " . " )
1234
1235
}
1235
1236
1236
1237
/** Evaluate an expression with the given value for `this` in a given class `klass`
@@ -1395,14 +1396,14 @@ object Semantic:
1395
1396
case Match (selector, cases) =>
1396
1397
val res = eval(selector, thisV, klass)
1397
1398
extendTrace(selector) {
1398
- res.ensureHot(" The value to be matched needs to be fully initialized." )
1399
+ res.ensureHot(" The value to be matched needs to be fully initialized. Found = " + res.show + " . " )
1399
1400
}
1400
1401
eval(cases.map(_.body), thisV, klass).join
1401
1402
1402
1403
case Return (expr, from) =>
1403
1404
val res = eval(expr, thisV, klass)
1404
1405
extendTrace(expr) {
1405
- res.ensureHot(" return expression must be fully initialized." )
1406
+ res.ensureHot(" return expression must be fully initialized. Found = " + res.show + " . " )
1406
1407
}
1407
1408
1408
1409
case WhileDo (cond, body) =>
0 commit comments