Skip to content

Commit 7171211

Browse files
authored
added HashTableBuilder.rootNode to white list (#19943)
2 parents 3197b49 + c222381 commit 7171211

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: compiler/src/dotty/tools/dotc/transform/init/Objects.scala

+8-2
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)