diff --git a/project/ScalafixBuild.scala b/project/ScalafixBuild.scala index d72d67897..3c1897ffd 100644 --- a/project/ScalafixBuild.scala +++ b/project/ScalafixBuild.scala @@ -279,6 +279,14 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys { Compile / console / scalacOptions := compilerOptions.value :+ "-Yrepl-class-based", Compile / doc / scalacOptions ++= scaladocOptions, + Compile / unmanagedSourceDirectories ++= { + val dir = (Compile / sourceDirectory).value + scalaVersion.value match { + case `scala3LTS` => Seq(dir / "scala-3lts") + case `scala3Next` => Seq(dir / "scala-3next") + case _ => Nil + } + }, // Don't package sources & docs when publishing locally as it adds a significant // overhead when testing because of publishLocalTransitive. Tweaking publishArtifact // would more readable, but it would also affect remote (sonatype) publishing. diff --git a/scalafix-tests/input/src/main/scala-3lts/test/explicitResultTypes/BeforeScala3_4.scala b/scalafix-tests/input/src/main/scala-3lts/test/explicitResultTypes/BeforeScala3_4.scala new file mode 100644 index 000000000..3a64696e4 --- /dev/null +++ b/scalafix-tests/input/src/main/scala-3lts/test/explicitResultTypes/BeforeScala3_4.scala @@ -0,0 +1,13 @@ +/* +rules = ExplicitResultTypes +ExplicitResultTypes.fetchScala3CompilerArtifactsOnVersionMismatch = true +*/ +package test.explicitResultTypes + +object BeforeScala3_4 { + def foo = { + val xs = List(Some(1), None) + for Some(x) <- xs yield x + } +} + diff --git a/scalafix-tests/input/src/main/scala-3next/test/explicitResultTypes/Scala3_5OrGreater.scala b/scalafix-tests/input/src/main/scala-3next/test/explicitResultTypes/Scala3_5OrGreater.scala new file mode 100644 index 000000000..0ddaee0c0 --- /dev/null +++ b/scalafix-tests/input/src/main/scala-3next/test/explicitResultTypes/Scala3_5OrGreater.scala @@ -0,0 +1,10 @@ +/* +rules = ExplicitResultTypes +ExplicitResultTypes.skipSimpleDefinitions = false +*/ +package test.explicitResultTypes + +object Scala3_5OrGreater { + def foo = 0b0010_0000 +} + diff --git a/scalafix-tests/output/src/main/scala-3lts/test/explicitResultTypes/BeforeScala3_4.scala b/scalafix-tests/output/src/main/scala-3lts/test/explicitResultTypes/BeforeScala3_4.scala new file mode 100644 index 000000000..09b92d709 --- /dev/null +++ b/scalafix-tests/output/src/main/scala-3lts/test/explicitResultTypes/BeforeScala3_4.scala @@ -0,0 +1,8 @@ +package test.explicitResultTypes + +object BeforeScala3_4 { + def foo: List[Int] = { + val xs = List(Some(1), None) + for Some(x) <- xs yield x + } +} \ No newline at end of file diff --git a/scalafix-tests/output/src/main/scala-3next/test/explicitResultTypes/Scala3_5OrGreater.scala b/scalafix-tests/output/src/main/scala-3next/test/explicitResultTypes/Scala3_5OrGreater.scala new file mode 100644 index 000000000..c02646d1c --- /dev/null +++ b/scalafix-tests/output/src/main/scala-3next/test/explicitResultTypes/Scala3_5OrGreater.scala @@ -0,0 +1,6 @@ +package test.explicitResultTypes + +object Scala3_5OrGreater { + def foo: Int = 0b0010_0000 +} +