1
1
package fix
2
- // scalafmt: { maxColumn = 120 }
3
2
4
- import scala .collection .JavaConverters ._
5
3
import scalafix ._
6
4
import scalafix .syntax ._
7
- import scalafix .internal .util .SymbolOps
8
5
import scala .meta ._
9
- import org .scalameta .logger
10
6
11
- case class Collectionstrawman_v0 (mirror : SemanticCtx ) extends SemanticRewrite (mirror) {
7
+ case class Collectionstrawman_v0 (mirror : SemanticCtx )
8
+ extends SemanticRewrite (mirror) {
12
9
val immutableListSymbol = Symbol (" _root_.scala.collection.immutable.List." )
13
10
val unimports = Map (
14
11
Symbol (" _root_.scala.Predef.augmentString." ) ->
@@ -18,14 +15,8 @@ case class Collectionstrawman_v0(mirror: SemanticCtx) extends SemanticRewrite(mi
18
15
)
19
16
20
17
def ifSymbolFound (ctx : RewriteCtx ): Patch = {
21
- logger.elem(ctx.mirror.names)
22
18
val toImport = ctx.mirror.names
23
- .flatMap(r =>
24
- unimports.get {
25
- val x = r.sym.normalized
26
- logger.elem(x)
27
- x
28
- })
19
+ .flatMap(r => unimports.get(r.sym.normalized))
29
20
.map(ctx.addGlobalImport)
30
21
toImport.asPatch
31
22
}
@@ -35,8 +26,9 @@ case class Collectionstrawman_v0(mirror: SemanticCtx) extends SemanticRewrite(mi
35
26
s " scala.Predef. $name" -> s " strawman.collection.immutable. $name"
36
27
def s (name : String , rename : Option [String ] = None ) =
37
28
s " scala. $name" -> s " strawman.collection.immutable. ${rename.getOrElse(name)}"
38
- def i (name : String ) =
39
- s " scala.collection.immutable. $name" -> s " strawman.collection.immutable. $name"
29
+ def i (name : String , rename : Option [String ] = None ) =
30
+ s " scala.collection.immutable. $name" ->
31
+ s " strawman.collection.immutable. ${rename.getOrElse(name)}"
40
32
def m (name : String ) =
41
33
s " scala.collection.mutable. $name" -> s " strawman.collection.mutable. $name"
42
34
ifSymbolFound(ctx) +
@@ -54,6 +46,7 @@ case class Collectionstrawman_v0(mirror: SemanticCtx) extends SemanticRewrite(mi
54
46
i(" `+:`" ),
55
47
s(" `:+`" ),
56
48
i(" `:+`" ),
49
+ i(" Stream" , Some (" LazyList" )),
57
50
s(" Stream" , Some (" LazyList" )),
58
51
s(" `#::`" ),
59
52
s(" `#::`" ),
0 commit comments