Skip to content

Commit

Permalink
Add test for ExlicitResultTypes fix
Browse files Browse the repository at this point in the history
This reproduces an issue discovered in a Mill PR

* com-lihaoyi/mill#2922
  • Loading branch information
lefou authored and joan38 committed Jan 7, 2024
1 parent 8179e4f commit 3306a36
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion itest/src/fix/.scalafix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ rules = [
DisableSyntax
LeakingImplicitClassVal
NoValInForComprehension
ProcedureSyntax
ProcedureSyntax,
ExplicitResultTypes
]

DisableSyntax.noVars = true
Expand Down
2 changes: 2 additions & 0 deletions itest/src/fix/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import os._

object project extends ScalaModule with ScalafixModule {
def scalaVersion = "2.13.10"
def scalafixScalaBinaryVersion = mill.scalalib.api.ZincWorkerUtil.scalaBinaryVersion(scalaVersion())
def scalacOptions = Seq("-Ywarn-unused")
}

Expand All @@ -14,6 +15,7 @@ def verify() =
val fixedScala = read(pwd / "project" / "src" / "Fix.scala")
val expected = """object Fix {
| def procedure(): Unit = {}
| def myComplexMethod: Map[Int, String] = 1.to(10).map(i => i -> i.toString).toMap
|}
|""".stripMargin
assert(fixedScala == expected)
Expand Down
1 change: 1 addition & 0 deletions itest/src/fix/project/src/Fix.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
object Fix {
def procedure() {}
def myComplexMethod = 1.to(10).map(i => i -> i.toString).toMap
}

0 comments on commit 3306a36

Please sign in to comment.