@@ -35,6 +35,16 @@ import scala.collection.JavaConverters._
35
35
import scala .annotation .internal .sharable
36
36
import config .Printers .typr
37
37
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
+
38
48
object Symbols {
39
49
40
50
implicit def eqSymbol : CanEqual [Symbol , Symbol ] = CanEqual .derived
@@ -46,12 +56,19 @@ object Symbols {
46
56
* @param coord The coordinates of the symbol (a position or an index)
47
57
* @param id A unique identifier of the symbol (unique per ContextBase)
48
58
*/
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> " )
50
60
extends Designator , ParamInfo , SrcPos , printing.Showable {
51
61
52
62
type ThisName <: Name
53
63
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)
55
72
56
73
def coord : Coord = myCoord
57
74
@@ -76,6 +93,10 @@ object Symbols {
76
93
77
94
/** Set defining tree if this symbol retains its definition tree */
78
95
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]")
79
100
if (retainsDefTree) myDefTree = tree
80
101
81
102
/** Does this symbol retain its definition tree?
@@ -368,8 +389,8 @@ object Symbols {
368
389
type TermSymbol = Symbol { type ThisName = TermName }
369
390
type TypeSymbol = Symbol { type ThisName = TypeName }
370
391
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 ) {
373
394
374
395
type ThisName = TypeName
375
396
@@ -516,7 +537,7 @@ object Symbols {
516
537
info : Type ,
517
538
privateWithin : Symbol = NoSymbol ,
518
539
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 }]
520
541
val denot = SymDenotation (sym, owner, name, flags, info, privateWithin)
521
542
sym.denot = denot
522
543
sym
@@ -534,7 +555,7 @@ object Symbols {
534
555
coord : Coord = NoCoord ,
535
556
assocFile : AbstractFile = null )(using Context ): ClassSymbol
536
557
= {
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> " ) )
538
559
val denot = SymDenotation (cls, owner, name, flags, infoFn(cls), privateWithin)
539
560
cls.denot = denot
540
561
cls
0 commit comments