Skip to content

Commit 9ce9ea3

Browse files
committed
Use MutableSymbolMap update instead of put
1 parent 14d9fc2 commit 9ce9ea3

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

compiler/src/dotty/tools/backend/jvm/GenBCode.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class GenBCode extends Phase {
4343
private val superCallsMap = newMutableSymbolMap[Set[ClassSymbol]]
4444
def registerSuperCall(sym: Symbol, calls: ClassSymbol) = {
4545
val old = superCallsMap.getOrElse(sym, Set.empty)
46-
superCallsMap.put(sym, old + calls)
46+
superCallsMap.update(sym, old + calls)
4747
}
4848

4949
def outputDir(implicit ctx: Context): AbstractFile =

compiler/src/dotty/tools/dotc/core/Comments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ object Comments {
3333
def docstring(sym: Symbol): Option[Comment] = _docstrings.get(sym)
3434

3535
def addDocstring(sym: Symbol, doc: Option[Comment]): Unit =
36-
doc.map(d => _docstrings.put(sym, d))
36+
doc.map(d => _docstrings.update(sym, d))
3737
}
3838

3939
/** A `Comment` contains the unformatted docstring as well as a position

compiler/src/dotty/tools/dotc/transform/localopt/Devalify.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Devalify extends Optimisation {
4343
tp.foreachPart(x => x match {
4444
case TermRef(NoPrefix, _) =>
4545
val b4 = timesUsedAsType.getOrElseUpdate(x.termSymbol, 0)
46-
timesUsedAsType.put(x.termSymbol, b4 + 1)
46+
timesUsedAsType.update(x.termSymbol, b4 + 1)
4747
case _ =>
4848
})
4949
}
@@ -55,7 +55,7 @@ class Devalify extends Optimisation {
5555

5656
dropCasts(valdef.rhs) match {
5757
case t: Tree if readingOnlyVals(t) =>
58-
copies.put(valdef.symbol, valdef.rhs)
58+
copies.update(valdef.symbol, valdef.rhs)
5959
case _ =>
6060
}
6161
visitType(valdef.symbol.info)
@@ -77,7 +77,7 @@ class Devalify extends Optimisation {
7777
case t: TypeApply => t.args.foreach(x => visitType(x.tpe))
7878
case t: RefTree =>
7979
val b4 = used.getOrElseUpdate(t.symbol, 0)
80-
used.put(t.symbol, b4 + 1)
80+
used.update(t.symbol, b4 + 1)
8181
case _ =>
8282
}
8383

compiler/src/dotty/tools/dotc/transform/localopt/InlineLabelsCalledOnce.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ class InlineLabelsCalledOnce extends Optimisation {
3131
isRecursive = true
3232
}
3333
if (!isRecursive)
34-
defined.put(d.symbol, d)
34+
defined.update(d.symbol, d)
3535

3636
case t: Apply if t.symbol.is(Label) =>
3737
val b4 = timesUsed.getOrElseUpdate(t.symbol, 0)
38-
timesUsed.put(t.symbol, b4 + 1)
38+
timesUsed.update(t.symbol, b4 + 1)
3939

4040
case _ =>
4141
}
@@ -55,7 +55,7 @@ class InlineLabelsCalledOnce extends Optimisation {
5555

5656
case d: DefDef if usedOnce(d) =>
5757
simplify.println(s"Dropping labeldef (used once) ${d.name} ${timesUsed.get(d.symbol)}")
58-
defined.put(d.symbol, d)
58+
defined.update(d.symbol, d)
5959
EmptyTree
6060

6161
case d: DefDef if neverUsed(d) =>

compiler/src/dotty/tools/dotc/transform/localopt/RemoveUnnecessaryNullChecks.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ import scala.collection.mutable
6262
case t: Literal => t.const.value != null
6363

6464
case t: Ident if !t.symbol.owner.isClass =>
65-
checkGood.put(target, checkGood.getOrElse(target, Set.empty) + t.symbol)
65+
checkGood.update(target, checkGood.getOrElse(target, Set.empty) + t.symbol)
6666
true
6767

6868
case t: Apply if !t.symbol.owner.isClass =>
69-
checkGood.put(target, checkGood.getOrElse(target, Set.empty) + t.symbol)
69+
checkGood.update(target, checkGood.getOrElse(target, Set.empty) + t.symbol)
7070
true
7171

7272
case t: Typed =>

compiler/src/dotty/tools/dotc/transform/localopt/Varify.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ import scala.collection.mutable
3838

3939
def visitor(implicit ctx: Context): Tree => Unit = {
4040
case t: ValDef if t.symbol.is(Param) =>
41-
paramsTimesUsed.put(t.symbol, 0)
41+
paramsTimesUsed.update(t.symbol, 0)
4242

4343
case t: ValDef if t.symbol.is(Mutable) =>
4444
t.rhs.foreachSubTree { subtree =>
4545
if (paramsTimesUsed.contains(subtree.symbol) &&
4646
t.symbol.info.widenDealias <:< subtree.symbol.info.widenDealias) {
4747
val newSet = possibleRenames.getOrElse(t.symbol, Set.empty) + subtree.symbol
48-
possibleRenames.put(t.symbol, newSet)
48+
possibleRenames.update(t.symbol, newSet)
4949
}
5050
}
5151

5252
case t: RefTree if paramsTimesUsed.contains(t.symbol) =>
5353
val param = t.symbol
5454
val current = paramsTimesUsed.get(param)
55-
current foreach { c => paramsTimesUsed.put(param, c + 1) }
55+
current foreach { c => paramsTimesUsed.update(param, c + 1) }
5656

5757
case _ =>
5858
}

0 commit comments

Comments
 (0)