File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,13 @@ import dotty.tools.dotc.core.Flags.AbstractOrTrait
6666 * whole-program analysis. However, the check is not modular in terms of project boundaries.
6767 *
6868 */
69- class Objects :
69+ import Decorators .*
70+ class Objects (using Context @ constructorOnly):
71+ val immutableHashSetBuider : Symbol = requiredClass(" scala.collection.immutable.HashSetBuilder" )
72+ // TODO: this should really be an annotation on the rhs of the field initializer rather than the field itself.
73+ val HashSetBuilder_rootNode : Symbol = immutableHashSetBuider.requiredValue(" rootNode" )
74+
75+ val whiteList = Set (HashSetBuilder_rootNode )
7076
7177 // ----------------------------- abstract domain -----------------------------
7278
@@ -1687,8 +1693,8 @@ class Objects:
16871693 // class body
16881694 tpl.body.foreach {
16891695 case vdef : ValDef if ! vdef.symbol.is(Flags .Lazy ) && ! vdef.rhs.isEmpty =>
1690- val res = eval(vdef.rhs, thisV, klass)
16911696 val sym = vdef.symbol
1697+ val res = if (whiteList.contains(sym)) Bottom else eval(vdef.rhs, thisV, klass)
16921698 if sym.is(Flags .Mutable ) then
16931699 val addr = Heap .fieldVarAddr(summon[Regions .Data ], sym, State .currentObject)
16941700 thisV.initVar(sym, addr)
You can’t perform that action at this time.
0 commit comments