Skip to content

AnyRefMap and LongMap's += method's signature is incorrect, should be a tuple #12012

@SethTisue

Description

@SethTisue

e.g. AnyRefMap has:

  def +=(key: K, value: V): this.type = { update(key, value); this }
  @inline final def addOne(key: K, value: V): this.type = { update(key, value); this }
  @inline override final def addOne(kv: (K, V)): this.type = { update(kv._1, kv._2); this }

But the += signature is inconsistent with other maps, where the method of the same name takes a tuple. It's also inconsistent with Scala's gradual move away from allowing multi-arg infix calls.

This turned up in scala/scala#8998, which increases the level of linting we do in src/library, resulting in:

[error] /Users/tisue/scala.213/src/library/scala/collection/mutable/AnyRefMap.scala:297:7: multiarg infix syntax looks like a tuple and will be deprecated
[error]   def +=(key: K, value: V): this.type = { update(key, value); this }
[error]       ^

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions