scala-ide / scalariform

Scala source code formatter
http://scala-ide.github.com/scalariform/
MIT License
527 stars 148 forks source link

Import scala.collection.immutable.Seq #251

Closed nrktkt closed 6 years ago

nrktkt commented 6 years ago

A handy feature would be to add an import for scala.collection.immutable.Seq any time the Seq predef is used, unless scala.collection.Seq or scala.collection.mutable.Seq is already imported.

This would probably be disabled by default, but would be very handy for people who want to enforce immutable Seqs.

A useful example:

case class MyCaseClass(strings: Seq[String])

would become

scala.collection.immutable.Seq

case class MyCaseClass(strings: Seq[String])

We typically expect our case classes to be immutable, preventing a missed import from leading to unexpected behavior from side-effects is a nice thing to have.

godenji commented 6 years ago

I think this issue will be resolved in Scala 2.13 (defaults to immutable Seq).

Also, out of scope, better suited to scala-refactoring