Open
Description
Compiler version
3.1.0
Minimized code
case class C(c: Int) {
def +(i: Int, j: Int): C = new C(c + i*j)
}
object Test extends App {
println {
var x = new C(42)
x = x + (3, 9)
x
}
println {
var x = new C(42)
x.+=(3, 9)
x
}
println {
var x = new C(42)
x += (3, 9)
x
}
}
Output
-- [E008] Not Found Error: multi.scala:19:6 -----------------------------------------------------------------------------------------------------
19 | x += (3, 9)
| ^^^^
| value += is not a member of C - did you mean C.!=?
1 error found
Expectation
If the compiler accepts multiarg infix (and maybe it should not), it should accept multiarg assignment syntax.
Scala 2 -Xlint
says
multi.scala:3: warning: multiarg infix syntax looks like a tuple and will be deprecated
def +(i: Int, j: Int): C = new C(c + i*j)
^
multi.scala:9: warning: multiarg infix syntax looks like a tuple and will be deprecated
x = x + (3, 9)
^
and fails to warn for assignment syntax.
Reported on discord:
just started learning Scala (3)... i'm a bit confused why this works [snip] but this does not