Skip to content

Commit 4b91876

Browse files
authored
Merge pull request #187 from unarist/scalafix-0.11.0
2 parents 244acc5 + ba4bcf4 commit 4b91876

File tree

7 files changed

+24
-23
lines changed

7 files changed

+24
-23
lines changed

project/plugins.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
2-
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4")
2+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.0")

rewrites/src/main/scala/fix/scala213/Any2StringAdd.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ final class Any2StringAdd extends SemanticRule("fix.scala213.Any2StringAdd") {
2222

2323
override def fix(implicit doc: SemanticDocument): Patch = {
2424
doc.tree.collect {
25-
case any2stringaddPlusString(Term.ApplyInfix(lhs, _, _, _)) => wrapStringValueOf(lhs)
26-
case primitivePlusString(Term.ApplyInfix(lhs, _, _, _)) => blankStringPlus(lhs)
25+
case any2stringaddPlusString(Term.ApplyInfix.Initial(lhs, _, _, _)) => wrapStringValueOf(lhs)
26+
case primitivePlusString(Term.ApplyInfix.Initial(lhs, _, _, _)) => blankStringPlus(lhs)
2727
}.asPatch
2828
}
2929

rewrites/src/main/scala/fix/scala213/Core.scala

+15-15
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@ final class Core extends SemanticRule("fix.scala213.Core") {
2020

2121
val platformArraycopy: Replacer = {
2222
case arraycopy(i: Importee) => Patch.removeImportee(i)
23-
case arraycopy(Term.Apply(t, _)) => replaceTree(t, "System.arraycopy")
23+
case arraycopy(Term.Apply.Initial(t, _)) => replaceTree(t, "System.arraycopy")
2424
}
2525

2626
val consoleRead: Replacer = {
27-
case deprecatedConsoleReadBoolean(Term.Apply(t, _)) => stdInReplace(t, "readBoolean")
28-
case deprecatedConsoleReadByte( Term.Apply(t, _)) => stdInReplace(t, "readByte")
29-
case deprecatedConsoleReadChar( Term.Apply(t, _)) => stdInReplace(t, "readChar")
30-
case deprecatedConsoleReadDouble( Term.Apply(t, _)) => stdInReplace(t, "readDouble")
31-
case deprecatedConsoleReadFloat( Term.Apply(t, _)) => stdInReplace(t, "readFloat")
32-
case deprecatedConsoleReadInt( Term.Apply(t, _)) => stdInReplace(t, "readInt")
33-
case deprecatedConsoleReadLine( Term.Apply(t, _)) => stdInReplace(t, "readLine")
34-
case deprecatedConsoleReadLine1( Term.Apply(t, _)) => stdInReplace(t, "readLine")
35-
case deprecatedConsoleReadLong( Term.Apply(t, _)) => stdInReplace(t, "readLong")
36-
case deprecatedConsoleReadShort( Term.Apply(t, _)) => stdInReplace(t, "readShort")
37-
case deprecatedConsoleReadf( Term.Apply(t, _)) => stdInReplace(t, "readf")
38-
case deprecatedConsoleReadf1( Term.Apply(t, _)) => stdInReplace(t, "readf1")
39-
case deprecatedConsoleReadf2( Term.Apply(t, _)) => stdInReplace(t, "readf2")
40-
case deprecatedConsoleReadf3( Term.Apply(t, _)) => stdInReplace(t, "readf3")
27+
case deprecatedConsoleReadBoolean(Term.Apply.Initial(t, _)) => stdInReplace(t, "readBoolean")
28+
case deprecatedConsoleReadByte( Term.Apply.Initial(t, _)) => stdInReplace(t, "readByte")
29+
case deprecatedConsoleReadChar( Term.Apply.Initial(t, _)) => stdInReplace(t, "readChar")
30+
case deprecatedConsoleReadDouble( Term.Apply.Initial(t, _)) => stdInReplace(t, "readDouble")
31+
case deprecatedConsoleReadFloat( Term.Apply.Initial(t, _)) => stdInReplace(t, "readFloat")
32+
case deprecatedConsoleReadInt( Term.Apply.Initial(t, _)) => stdInReplace(t, "readInt")
33+
case deprecatedConsoleReadLine( Term.Apply.Initial(t, _)) => stdInReplace(t, "readLine")
34+
case deprecatedConsoleReadLine1( Term.Apply.Initial(t, _)) => stdInReplace(t, "readLine")
35+
case deprecatedConsoleReadLong( Term.Apply.Initial(t, _)) => stdInReplace(t, "readLong")
36+
case deprecatedConsoleReadShort( Term.Apply.Initial(t, _)) => stdInReplace(t, "readShort")
37+
case deprecatedConsoleReadf( Term.Apply.Initial(t, _)) => stdInReplace(t, "readf")
38+
case deprecatedConsoleReadf1( Term.Apply.Initial(t, _)) => stdInReplace(t, "readf1")
39+
case deprecatedConsoleReadf2( Term.Apply.Initial(t, _)) => stdInReplace(t, "readf2")
40+
case deprecatedConsoleReadf3( Term.Apply.Initial(t, _)) => stdInReplace(t, "readf3")
4141
}
4242

4343
private def stdInReplace(tree: Tree, name: String): Patch =

rewrites/src/main/scala/fix/scala213/ExplicitNonNullaryApply.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ final class ExplicitNonNullaryApply(global: LazyValue[ScalafixGlobal])
5959
if handled.add(name)
6060
if noArgs
6161
if name.isReference
62-
if !cond(name.parent) { case Some(Term.ApplyInfix(_, `name`, _, _)) => true }
62+
if !cond(name.parent) { case Some(Term.ApplyInfix.Initial(_, `name`, _, _)) => true }
6363
if !tree.parent.exists(_.is[Term.Eta]) // else rewrites `meth _` to `meth() _`, or requires running ExplicitNullaryEtaExpansion first
6464
// HACK: In certain cases, `Symbol.info` may throw `MissingSymbolException` due to some unknown reason
6565
// If it happens, here we assume that this symbol has no info

rewrites/src/main/scala/fix/scala213/NullaryHashHash.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ final class NullaryHashHash extends SemanticRule("fix.scala213.NullaryHashHash")
99

1010
override def fix(implicit doc: SemanticDocument) = {
1111
doc.tree.collect {
12-
case expr @ Term.Apply(HashHash(fun), Nil) =>
12+
case expr @ Term.Apply.Initial(HashHash(fun), Nil) =>
1313
Patch.removeTokens(expr.tokens.takeRight(expr.pos.end - fun.pos.end))
1414
}.asPatch
1515
}

rewrites/src/main/scala/fix/scala213/ScalaSeq.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class ScalaSeq(val config: ScalaSeq.Config) extends SemanticRule("fix.scal
3434
inParam = false
3535
apply(p.default)
3636

37-
case scalaSeq(Type.Apply(t, _)) =>
37+
case scalaSeq(Type.Apply.Initial(t, _)) =>
3838
val sub = if (inParam) {
3939
paramImport.foreach(i => patch += globalImports.add(i))
4040
config.paramType

tests/src/test/scala/fix/RuleSuite.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package fix
22

33
import scala.reflect.ensureAccessible
4-
import org.scalatest.{ ConfigMap, FunSpecLike }
4+
import org.scalatest.ConfigMap
5+
import org.scalatest.funspec.AnyFunSpecLike
56
import scalafix.testkit.AbstractSemanticRuleSuite
67

7-
class RuleSuite extends AbstractSemanticRuleSuite with FunSpecLike with BeforeAndAfterAllConfigMapAlt {
8+
class RuleSuite extends AbstractSemanticRuleSuite with AnyFunSpecLike with BeforeAndAfterAllConfigMapAlt {
89
val isSaveExpectField = ensureAccessible(classOf[AbstractSemanticRuleSuite].getDeclaredField("isSaveExpect"))
910

1011
// If you invoke the test as "tests/testOnly -- -Doverwrite=true" it will save the expected

0 commit comments

Comments
 (0)