Skip to content

Commit

Permalink
Remove rules from migrate-syntax that are provided by scala 3 compile…
Browse files Browse the repository at this point in the history
…r rewrite (#243)

+ add Explicit result types that helps with the inference
  • Loading branch information
mlachkar authored Jun 14, 2021
1 parent 1a070b8 commit 3a645b3
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 75 deletions.
5 changes: 5 additions & 0 deletions input/src/main/scala/migrateSyntax/Any2String.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package migrateSyntax

object Any2String {
val str = new AnyRef + "foo"
}
8 changes: 0 additions & 8 deletions input/src/main/scala/migrateSyntax/AutoApplication.scala

This file was deleted.

5 changes: 0 additions & 5 deletions input/src/main/scala/migrateSyntax/LambdaParam.scala

This file was deleted.

6 changes: 0 additions & 6 deletions input/src/main/scala/migrateSyntax/ValueEtaExpansion.scala

This file was deleted.

8 changes: 1 addition & 7 deletions migrate/src/main/scala/migrate/utils/ScalafixService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,7 @@ object ScalafixService {
private lazy val internalRules = getClassPathforMigrateRules()
private lazy val externalRules = getClassPathforRewriteRules()

val fixSyntaxRules: Seq[String] = Seq(
"ProcedureSyntax",
"fix.scala213.ExplicitNullaryEtaExpansion",
"fix.scala213.ParensAroundLambda",
"fix.scala213.ExplicitNonNullaryApply",
"fix.scala213.Any2StringAdd"
)
val fixSyntaxRules: Seq[String] = Seq("ProcedureSyntax", "fix.scala213.Any2StringAdd", "ExplicitResultTypes")
val addExplicitResultTypesAndImplicits: Seq[String] = Seq("MigrationRule")

def from(compilerOptions: Seq[String], classpath: Classpath, targetRootSemantic: AbsolutePath): Try[ScalafixService] =
Expand Down
2 changes: 0 additions & 2 deletions migrate/src/test/scala/migrate/MigrateLibsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class MigrateLibsSuite extends AnyFunSuiteLike {
val migrated = Scala3Migrate.migrateLibs(Seq(cats213)).allLibs
val res = migrated(cats213)
assert(res.isCompatibleWithScala3)
println(s"res = ${res}")
assert(res.asInstanceOf[CompatibleWithScala3.Lib].crossVersion.isInstanceOf[CrossVersion.Binary])
}
test("Don't show older version") {
Expand Down Expand Up @@ -94,7 +93,6 @@ class MigrateLibsSuite extends AnyFunSuiteLike {
assert(message == "Other versions are avaialble for Scala 3: \"1\", ..., \"4\"")
val revisions2 = Seq(Revision("1"), Revision("2"))
val message2 = Reason.Scala3LibAvailable(revisions2).why
println(s"message2 = ${message2}")
assert(message2 == "Other versions are avaialble for Scala 3: \"1\", \"2\"")
}

Expand Down
5 changes: 5 additions & 0 deletions output/src/main/scala/migrateSyntax/Any2String.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package migrateSyntax

object Any2String {
val str: String = String.valueOf(new AnyRef) + "foo"
}
8 changes: 0 additions & 8 deletions output/src/main/scala/migrateSyntax/AutoApplication.scala

This file was deleted.

5 changes: 0 additions & 5 deletions output/src/main/scala/migrateSyntax/LambdaParam.scala

This file was deleted.

6 changes: 0 additions & 6 deletions output/src/main/scala/migrateSyntax/ValueEtaExpansion.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ object MigrateSyntaxTest {
}
}

//fix.scala213.ParensAroundLambda
val f = { x: Int => x * x }

//fix.scala213.ExplicitNonNullaryApply
trait Chunk {
def bytes(): Seq[Byte]

def toSeq: Seq[Byte] = bytes
}

//fix.scala213.ExplicitNullaryEtaExpansion
val x = 1
val g: () => Int = x _

//fix.scala213.Any2StringAdd
val str = new AnyRef + "foo"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ object MigrateSyntax {
}
}

//fix.scala213.ParensAroundLambda
val f = { x: Int => x * x }

//fix.scala213.ExplicitNonNullaryApply
trait Chunk {
def bytes(): Seq[Byte]

def toSeq: Seq[Byte] = bytes
}

//fix.scala213.ExplicitNullaryEtaExpansion
val x = 1
val g: () => Int = x _

//fix.scala213.Any2StringAdd
val str = new AnyRef + "foo"
}

0 comments on commit 3a645b3

Please sign in to comment.