|
1 |
| -[](https://index.scala-lang.org/scala/scala-collection-compat/scala-collection-compat) |
2 |
| - |
3 | 1 | ## Purpose and scope
|
4 | 2 |
|
5 | 3 | This library makes some Scala 2.13 APIs available on Scala 2.11 and 2.12.
|
6 | 4 |
|
7 | 5 | The idea is to facilitate
|
8 | 6 | [cross-building](https://github.com/scala/collection-strawman/wiki/FAQ#how-do-i-cross-build-my-project-against-scala-212-and-scala-213)
|
9 |
| -Scala 2.13 and 3.0 code on the older versions. |
| 7 | +Scala 2.13 code on the older versions. |
10 | 8 |
|
11 |
| -Although the name of the library is scala-"collection"-compat, we have now widened the scope to include other parts of the Scala 2.13/3.0 standard library besides just collections. |
| 9 | +Although the name of the library is scala-"collection"-compat, we have now widened the scope to include other parts of the Scala 2.13 standard library besides just collections. |
12 | 10 |
|
13 | 11 | Only the most commonly used APIs are supported; many are missing. Contributions are welcome.
|
14 | 12 |
|
15 | 13 | ## Usage
|
16 | 14 |
|
17 |
| -To use this library, add the following to your `build.sbt`: |
| 15 | +This library is available on the JVM, Scala.js, and Scala Native. |
18 | 16 |
|
19 |
| -``` |
20 |
| -libraryDependencies += "org.scala-lang.modules" %% "scala-collection-compat" % "<version>" |
21 |
| -``` |
| 17 | +| tool | coordinates | |
| 18 | +|:---------------:|:------------:| |
| 19 | +| sbt | `"org.scala-lang.modules" %% "scala-collection-compat" % "<version>"` | |
| 20 | +| scala-cli, mill | `org.scala-lang.modules::scala-collection-compat:<version>` | |
22 | 21 |
|
23 | 22 | All future versions will remain backwards binary compatible with 2.0.0. (The 1.0.0 release was withdrawn and should not be used.)
|
24 | 23 |
|
25 | 24 | ## How it works
|
26 | 25 |
|
27 |
| -The 2.13 and 3.0 versions consist only of an empty `scala.collection.compat` package object, so `import scala.collection.compat._` won't cause an error in cross-compiled code. |
| 26 | +The Scala 2.13 and Scala 3 versions consist only of an empty `scala.collection.compat` package object, so `import scala.collection.compat._` won't cause an error in cross-compiled code. |
28 | 27 |
|
29 | 28 | The 2.11 and 2.12 versions have the needed compatibility code in this package.
|
30 | 29 |
|
@@ -109,9 +108,10 @@ scalacOptions += "-P:semanticdb:synthetics:on"
|
109 | 108 | ```
|
110 | 109 |
|
111 | 110 | ### Fixing unused import warnings
|
| 111 | + |
112 | 112 | In Scala 2.13 the `import scala.collection.compat._` sometimes is not needed (e.g. `.to(SeqType)` is natively available).
|
113 | 113 | This leads to a `unused import` warning under Scala 2.13 even though the import is required for Scala 2.12.
|
114 |
| -In order to work around this, you can pass a compiler option to ignore this specific issue, e.g. in SBT: |
| 114 | +In order to work around this, you can pass a compiler option to ignore this specific issue, e.g. in sbt: |
115 | 115 | ```scala
|
116 | 116 | scalacOptions += "-Wconf:origin=scala.collection.compat.*:s"
|
117 | 117 | ```
|
|
0 commit comments