Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scala/scala-collection-compat
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.8.0
Choose a base ref
...
head repository: scala/scala-collection-compat
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.8.1
Choose a head ref
  • 5 commits
  • 5 files changed
  • 3 contributors

Commits on Jul 8, 2022

  1. Copy the full SHA
    a68f614 View commit details

Commits on Jul 15, 2022

  1. handle scalameta change in ApplyInfix RHS positions

    scalameta/scalameta#2684, first released in
    scalameta 4.5.1 (scalafix 0.10.0), changed a behavior, so this takes a
    more intrusive but also more robust approach so that the rule works
    with scalafix 0.10.x.
    bjaglin committed Jul 15, 2022
    Copy the full SHA
    3174d0d View commit details

Commits on Jul 25, 2022

  1. Update sbt to 1.7.1

    scala-steward authored and xuwei-k committed Jul 25, 2022
    Copy the full SHA
    a3411ab View commit details

Commits on Jul 26, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a7a85c3 View commit details

Commits on Jul 29, 2022

  1. set version policy for 2.8.1 release (#553)

    references #552
    SethTisue authored Jul 29, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0cf99c9 View commit details
Showing with 22 additions and 21 deletions.
  1. +1 −1 README.md
  2. +1 −1 build.sbt
  3. +1 −1 project/build.properties
  4. +1 −1 project/plugins.sbt
  5. +18 −17 scalafix/rules/src/main/scala/scala/fix/collection/Collection213Experimental.scala
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ The migration rules use scalafix. Please see the [official installation instruct

```scala
// project/plugins.sbt
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")
```

### Collection213Upgrade
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ lazy val compat = new MultiScalaCrossProject(
sharedSourceDir / "scala-2.11_2.12"
}
},
versionPolicyIntention := Compatibility.BinaryCompatible,
versionPolicyIntention := Compatibility.BinaryAndSourceCompatible,
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.7.0-RC2
sbt.version=1.7.1
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@ addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.2.0
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.5")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.2.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "3.0.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
Original file line number Diff line number Diff line change
@@ -53,28 +53,29 @@ case class Collection213ExperimentalV0(index: SemanticdbIndex)
}

def replaceSetMapPlusMinus(ctx: RuleCtx): Patch = {
def rewriteOp(op: Tree, rhs: Tree, doubleOp: String, col0: String): Patch = {
val col = "_root_.scala.collection." + col0
val callSite =
if (startsWithParens(rhs)) {
ctx.addLeft(rhs, col)
} else {
ctx.addLeft(rhs, col + "(") +
ctx.addRight(rhs, ")")
}

ctx.addRight(op, doubleOp) + callSite
def rewriteOp(ap: Term.ApplyInfix, doubleOp: String, col0: String): Patch = {
val col = col0 match {
case "Set" => q"_root_.scala.collection.Set"
case "Map" => q"_root_.scala.collection.Map"
}
val newAp = ap
.copy(
args = Term.Apply(col, ap.args) :: Nil,
op = Term.Name(doubleOp * 2)
)
.toString()
ctx.replaceTree(ap, newAp)
}

ctx.tree.collect {
case ap @ Term.ApplyInfix(CollectionSet(), op @ setPlus(_), Nil, List(rhs)) =>
rewriteOp(op, rhs, "+", "Set")
case ap @ Term.ApplyInfix(CollectionSet(), setPlus(_), Nil, _) =>
rewriteOp(ap, "+", "Set")

case Term.ApplyInfix(CollectionSet(), op @ setMinus(_), Nil, List(rhs)) =>
rewriteOp(op, rhs, "-", "Set")
case ap @ Term.ApplyInfix(CollectionSet(), setMinus(_), Nil, _) =>
rewriteOp(ap, "-", "Set")

case Term.ApplyInfix(_, op @ mapPlus(_), Nil, List(rhs)) =>
rewriteOp(op, rhs, "+", "Map")
case ap @ Term.ApplyInfix(_, op @ mapPlus(_), Nil, _) =>
rewriteOp(ap, "+", "Map")
}.asPatch
}