Skip to content

Commit 8a5cf8b

Browse files
committed
changed plain string to Definitions
1 parent e91006a commit 8a5cf8b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ 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+
class Objects(using Context @constructorOnly):
70+
val immutableHashSetBuider: Symbol = requiredClass("scala.collection.immutable.HashSetBuilder")
71+
val HashSetBuilder_rootNode: Symbol = immutableHashSetBuider.requiredValue("rootNode")
7072

7173
// ----------------------------- abstract domain -----------------------------
7274

@@ -1683,12 +1685,11 @@ class Objects:
16831685
end if
16841686

16851687
// class body
1686-
val whiteList = Set("scala.collection.immutable.Vector.emptyIterator")
1688+
val whiteList = Set(HashSetBuilder_rootNode)
16871689
tpl.body.foreach {
16881690
case vdef : ValDef if !vdef.symbol.is(Flags.Lazy) && !vdef.rhs.isEmpty =>
1689-
var res = eval(vdef.rhs, thisV, klass)
16901691
val sym = vdef.symbol
1691-
if (whiteList.contains(sym.showFullName)) res = Bottom
1692+
var res = if (whiteList.contains(sym)) Bottom else eval(vdef.rhs, thisV, klass)
16921693
if sym.is(Flags.Mutable) then
16931694
val addr = Heap.fieldVarAddr(summon[Regions.Data], sym, State.currentObject)
16941695
thisV.initVar(sym, addr)

0 commit comments

Comments
 (0)