Skip to content

Commit 6800269

Browse files
Fix build
1 parent e5ee373 commit 6800269

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

scalafix/output/src/main/scala/fix/BreakoutSrc.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,5 +104,5 @@ class BreakoutSrc(ts: Iterable[Int], vec: Vector[Int], list: List[Int], seq: Seq
104104
scala.collection.immutable.IntMap.from(List(1 -> "1").iterator.map(x => x)): immutable.IntMap[String]
105105
scala.collection.immutable.LongMap.from(List(1L -> "1").iterator.map(x => x)): immutable.LongMap[String]
106106
scala.collection.mutable.LongMap.from(List(1L -> "1").iterator.map(x => x)): mutable.LongMap[String]
107-
scala.collection.BitSet.from(List(1).iterator.map(x => x)): collection.BitSet
107+
scala.collection.BitSet.fromSpecific(List(1).iterator.map(x => x)): collection.BitSet
108108
}

scalafix/rules/src/main/scala/fix/Breakout.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ class BreakoutRewrite(addCompatImport: RuleCtx => Patch)(implicit val index: Sem
9898
"scala.collection.immutable.Map" -> "toMap"
9999
)
100100

101+
val toSpecificCollectionFromSpecific = Set(
102+
"scala.collection.BitSet"
103+
)
104+
101105
val toSpecificCollectionFrom = Set(
102106
"scala.collection.Map",
103-
"scala.collection.BitSet",
104107
"scala.collection.immutable.SortedMap",
105108
"scala.collection.immutable.HashMap",
106109
"scala.collection.immutable.ListMap",
@@ -113,7 +116,7 @@ class BreakoutRewrite(addCompatImport: RuleCtx => Patch)(implicit val index: Sem
113116
"scala.collection.immutable.IntMap",
114117
"scala.collection.immutable.LongMap",
115118
"scala.collection.mutable.LongMap"
116-
)
119+
) ++ toSpecificCollectionFromSpecific
117120

118121
// == rule ==
119122
def apply(ctx: RuleCtx): Patch = {
@@ -146,7 +149,12 @@ class BreakoutRewrite(addCompatImport: RuleCtx => Patch)(implicit val index: Sem
146149
case None =>
147150
if (toSpecificCollectionFrom.contains(col)) {
148151
requiresCompatImport = true
149-
ctx.addLeft(ap0, col + ".from(") +
152+
153+
val convertMethod =
154+
if (toSpecificCollectionFromSpecific.contains(col)) "fromSpecific"
155+
else "from"
156+
157+
ctx.addLeft(ap0, col + "." + convertMethod + "(") +
150158
ctx.addRight(ap0, ")")
151159
} else {
152160
Patch.empty

scalafix/rules/src/main/scala/fix/Roughly.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final case class Roughly(index: SemanticdbIndex, config: RoughlyConfig)
4646
)
4747

4848
val streamEmpty = SymbolMatcher.exact(
49-
Symbol("_root_.scala.collection.immutable.Stream.Empty.")
49+
Symbol("scala/collection/immutable/Stream.Empty.")
5050
)
5151

5252
def replaceSymbols(ctx: RuleCtx): Patch = {

0 commit comments

Comments
 (0)