https://kotlinlang.org logo
m

Marko Mitic

08/12/2019, 2:46 PM
Is this type inference bug?
list
is
MutableList<Bucket>
r

Ruckus

08/12/2019, 2:47 PM
No, it means
list
is a
var
, so it's ambiguous if it should be interpreted as
list = list.plus(bucket)
or
list.plusAsign(bucket)
https://kotlinlang.org/docs/reference/operator-overloading.html#assignments
If the corresponding binary function (i.e. plus() for plusAssign()) is available too, report error (ambiguity)
👍 1
m

Marko Mitic

08/12/2019, 2:56 PM
thanks, I wasn't aware of special rules for
+=
operator