scala-collection-compat
project (in the root directory): implementation of the compatibility library ;- In directory
scalafix/
there is an independent build containing the implementation of the migration tool.
Several levels of contribution are possible!
Create an issue tagged with the
migration label.
Embrace diff
s to describe differences between the standard collections and
the strawman:
- xs.toIterator
+ xs.iterator
Even better, instead of providing a diff, you can directly add it as a test case!
-
Fork this repository and create a separate branch;
-
Add a file in the
scalafix/input/src/main/scala/fix/
directory with code that uses the standard collections:
class toIteratorVsIterator(xs: Iterable[Int]) {
xs.toIterator
}
- Add a corresponding file in the
scalafix/output/src/main/scala/fix/
directory with the same code but using the strawman:
import strawman.collection.Iterable
class toIteratorVsIterator(xs: Iterable[Int]) {
xs.iterator
}
-
Check that your code example compiles
- run sbt from the
scalafix/
directory and then run the following tasks; input/compile ; output/compile
;
- run sbt from the
-
Commit your changes, push your branch to your fork and create a pull request.
Then maybe someone will take over and implement your use case… or maybe you will (see next section)!
Even better, complete the migration tool implementation to support the missing case!
After you have added the missing case (see previous section), run the following
sbt task (with sbt started from the scalafix/
directory) to run the
migration tool on the input files and check whether the result matches the
expected output files:
> tests/test
Fix the implementation of the rule (in the
rules/src/main/scala/fix/Scalacollectioncompat_v0.scala
file) until the
tests are green. You can find more help about the scalafix API in its
documentation.