@@ -35,6 +35,16 @@ import scala.collection.JavaConverters._
3535import scala .annotation .internal .sharable
3636import config .Printers .typr
3737
38+ object SymbolCapturing {
39+ def ids = Set (
40+ 2844 , // a.Foo$.foo (before)
41+ 2756 , // a.Foo (before)
42+ 4949 , // a.Foo$.foo (after)
43+ 2756 , // a.Foo (after)
44+ )
45+ def doCapture (sym : Symbol ): Boolean = ids.contains(sym.id)
46+ }
47+
3848object Symbols {
3949
4050 implicit def eqSymbol : CanEqual [Symbol , Symbol ] = CanEqual .derived
@@ -46,12 +56,19 @@ object Symbols {
4656 * @param coord The coordinates of the symbol (a position or an index)
4757 * @param id A unique identifier of the symbol (unique per ContextBase)
4858 */
49- class Symbol private [Symbols ] (private var myCoord : Coord , val id : Int )
59+ class Symbol private [Symbols ] (private var myCoord : Coord , val id : Int , val runUUID : String = " <no uuid> " )
5060 extends Designator , ParamInfo , SrcPos , printing.Showable {
5161
5262 type ThisName <: Name
5363
54- // assert(id != 723)
64+ val tracer : String | Null =
65+ if SymbolCapturing .doCapture(this ) then
66+ val tracer = Thread .currentThread().getStackTrace().mkString(" \n " , " \n " , " \n " )
67+ tracer
68+ else
69+ null
70+
71+ // assert(id != 723)
5572
5673 def coord : Coord = myCoord
5774
@@ -76,6 +93,10 @@ object Symbols {
7693
7794 /** Set defining tree if this symbol retains its definition tree */
7895 def defTree_= (tree : Tree )(using Context ): Unit =
96+ val fname = denot.fullName.toString
97+ if fname.contains(" a.Foo" ) || fname.contains(" a.Bar" ) then
98+ if tracer != null then
99+ report.echo(i " ` ${denot.fullName}.defTree = $tree` [did assign? $retainsDefTree, id? ${id}, phase? ${ctx.phase.phaseName}, run? $runUUID] " )// , $tracer]")
79100 if (retainsDefTree) myDefTree = tree
80101
81102 /** Does this symbol retain its definition tree?
@@ -368,8 +389,8 @@ object Symbols {
368389 type TermSymbol = Symbol { type ThisName = TermName }
369390 type TypeSymbol = Symbol { type ThisName = TypeName }
370391
371- class ClassSymbol private [Symbols ] (coord : Coord , val assocFile : AbstractFile , id : Int )
372- extends Symbol (coord, id) {
392+ class ClassSymbol private [Symbols ] (coord : Coord , val assocFile : AbstractFile , id : Int , runUUID : String )
393+ extends Symbol (coord, id, runUUID ) {
373394
374395 type ThisName = TypeName
375396
@@ -516,7 +537,7 @@ object Symbols {
516537 info : Type ,
517538 privateWithin : Symbol = NoSymbol ,
518539 coord : Coord = NoCoord )(using Context ): Symbol { type ThisName = N } = {
519- val sym = new Symbol (coord, ctx.base.nextSymId).asInstanceOf [Symbol { type ThisName = N }]
540+ val sym = new Symbol (coord, ctx.base.nextSymId, Option (ctx.run).map(_.uuid).getOrElse( " <no run> " ) ).asInstanceOf [Symbol { type ThisName = N }]
520541 val denot = SymDenotation (sym, owner, name, flags, info, privateWithin)
521542 sym.denot = denot
522543 sym
@@ -534,7 +555,7 @@ object Symbols {
534555 coord : Coord = NoCoord ,
535556 assocFile : AbstractFile = null )(using Context ): ClassSymbol
536557 = {
537- val cls = new ClassSymbol (coord, assocFile, ctx.base.nextSymId)
558+ val cls = new ClassSymbol (coord, assocFile, ctx.base.nextSymId, Option (ctx.run).map(_.uuid).getOrElse( " <no uuid> " ) )
538559 val denot = SymDenotation (cls, owner, name, flags, infoFn(cls), privateWithin)
539560 cls.denot = denot
540561 cls
0 commit comments