Warn about incorrect collections API usage
som-snytt opened this issue · 2 comments
som-snytt commented
Examples from a Scala ticket.
Provably wrong usages such as scalac warns about for certain operators.
scala> (1 to 3).scan(10)(+)
res0: scala.collection.immutable.IndexedSeq[Int] = Vector(10, 11, 13, 16)
scala> (1 to 3).par.scan(10)(+)
res1: scala.collection.parallel.immutable.ParSeq[Int] = ParVector(10, 11, 3, 6)
scala> (1 to 3).par.scan(0)(_ - _)
res2: scala.collection.parallel.immutable.ParSeq[Int] = ParVector(0, -1, -1, -4)
scala> (1 to 3).scan(0)(_ - _)
res3: scala.collection.immutable.IndexedSeq[Int] = Vector(0, -1, -3, -6)
SethTisue commented
Abide is superseded by https://github.com/scalacenter/scalafix; closing all issues
som-snytt commented
I'll propose this at scalafix as soon as there is a collections API.