Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added HashTableBuilder.rootNode to white list #19943

Merged
merged 5 commits into from
Mar 25, 2024
Merged
Changes from all 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
10 changes: 8 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,13 @@ import dotty.tools.dotc.core.Flags.AbstractOrTrait
* whole-program analysis. However, the check is not modular in terms of project boundaries.
*
*/
class Objects:
import Decorators.*
class Objects(using Context @constructorOnly):
val immutableHashSetBuider: Symbol = requiredClass("scala.collection.immutable.HashSetBuilder")
// TODO: this should really be an annotation on the rhs of the field initializer rather than the field itself.
val HashSetBuilder_rootNode: Symbol = immutableHashSetBuider.requiredValue("rootNode")
olhotak marked this conversation as resolved.
Show resolved Hide resolved

val whiteList = Set(HashSetBuilder_rootNode)

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

Expand Down Expand Up @@ -1685,8 +1691,8 @@ class Objects:
// class body
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
val res = if (whiteList.contains(sym)) Bottom else eval(vdef.rhs, thisV, klass)
if sym.is(Flags.Mutable) then
val addr = Heap.fieldVarAddr(summon[Regions.Data], sym, State.currentObject)
thisV.initVar(sym, addr)
Expand Down
Loading