Skip to content

Commit 13453d8

Browse files
committed
Show more debug information for reassignment
1 parent 93d46a8 commit 13453d8

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ object Semantic:
5252
*
5353
*/
5454
sealed abstract class Value:
55-
def show: String = this.toString()
55+
def show: String = this match
56+
case Warm(klass, outer, ctor, args) =>
57+
"Warm[" + klass + "] { outer = " + outer.show + ", args = " + args.map(_.show).mkString("(", ", ", ")") + " }"
58+
case Fun(expr, thisV, klass) =>
59+
"Fun { this = " + thisV.show + ", owner = " + klass + " }"
60+
case RefSet(values) =>
61+
values.map(_.show).mkString("Set { ", ", ", " }")
62+
case _ =>
63+
this.toString()
5664

5765
def isHot = this == Hot
5866
def isCold = this == Cold
@@ -1351,12 +1359,12 @@ object Semantic:
13511359
eval(qual, thisV, klass)
13521360
val res = eval(rhs, thisV, klass)
13531361
extendTrace(expr) {
1354-
res.ensureHot("The RHS of reassignment must be fully initialized.")
1362+
res.ensureHot("The RHS of reassignment must be fully initialized. Found = " + res.show + ". ")
13551363
}
13561364
case id: Ident =>
13571365
val res = eval(rhs, thisV, klass)
13581366
extendTrace(expr) {
1359-
res.ensureHot("The RHS of reassignment must be fully initialized.")
1367+
res.ensureHot("The RHS of reassignment must be fully initialized. Found = " + res.show + ". ")
13601368
}
13611369

13621370
case closureDef(ddef) =>

0 commit comments

Comments
 (0)