File tree 1 file changed +8
-2
lines changed
compiler/src/dotty/tools/dotc/transform/init
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
66
66
* whole-program analysis. However, the check is not modular in terms of project boundaries.
67
67
*
68
68
*/
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 )
70
76
71
77
// ----------------------------- abstract domain -----------------------------
72
78
@@ -1687,8 +1693,8 @@ class Objects:
1687
1693
// class body
1688
1694
tpl.body.foreach {
1689
1695
case vdef : ValDef if ! vdef.symbol.is(Flags .Lazy ) && ! vdef.rhs.isEmpty =>
1690
- val res = eval(vdef.rhs, thisV, klass)
1691
1696
val sym = vdef.symbol
1697
+ val res = if (whiteList.contains(sym)) Bottom else eval(vdef.rhs, thisV, klass)
1692
1698
if sym.is(Flags .Mutable ) then
1693
1699
val addr = Heap .fieldVarAddr(summon[Regions .Data ], sym, State .currentObject)
1694
1700
thisV.initVar(sym, addr)
You can’t perform that action at this time.
0 commit comments