Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/init/Objects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ import dotty.tools.dotc.core.Flags.AbstractOrTrait
* whole-program analysis. However, the check is not modular in terms of project boundaries.
*
*/
class Objects:
class Objects(using Context @constructorOnly):
val immutableHashSetBuider: Symbol = requiredClass("scala.collection.immutable.HashSetBuilder")
val HashSetBuilder_rootNode: Symbol = immutableHashSetBuider.requiredValue("rootNode")

// ----------------------------- abstract domain -----------------------------

Expand Down Expand Up @@ -1683,10 +1685,11 @@ class Objects:
end if

// class body
val whiteList = Set(HashSetBuilder_rootNode)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move it to be a field of the class Objects.

tpl.body.foreach {
case vdef : ValDef if !vdef.symbol.is(Flags.Lazy) && !vdef.rhs.isEmpty =>
val res = eval(vdef.rhs, thisV, klass)
val sym = vdef.symbol
var res = if (whiteList.contains(sym)) Bottom else eval(vdef.rhs, thisV, klass)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a val now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

if sym.is(Flags.Mutable) then
val addr = Heap.fieldVarAddr(summon[Regions.Data], sym, State.currentObject)
thisV.initVar(sym, addr)
Expand Down