diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..73504ec --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# Scala Steward: Reformat with scalafmt 3.8.0 +6df2f1f7bffbc455329c35336848f3a311955dcd diff --git a/.scalafmt.conf b/.scalafmt.conf index 1b8d920..2290e7e 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -7,4 +7,4 @@ fileOverride { style = defaultWithAlign maxColumn = 120 -version = 3.5.9 \ No newline at end of file +version = 3.8.0 \ No newline at end of file diff --git a/benchmark/build.sbt b/benchmark/build.sbt index 2c44dbc..bb17cb1 100644 --- a/benchmark/build.sbt +++ b/benchmark/build.sbt @@ -1 +1 @@ -enablePlugins(JmhPlugin) \ No newline at end of file +enablePlugins(JmhPlugin) diff --git a/macros/src/main/scala-2/io/github/metarank/cfor/Syntax.scala b/macros/src/main/scala-2/io/github/metarank/cfor/Syntax.scala index 878c44f..d1a6705 100644 --- a/macros/src/main/scala-2/io/github/metarank/cfor/Syntax.scala +++ b/macros/src/main/scala-2/io/github/metarank/cfor/Syntax.scala @@ -52,7 +52,7 @@ class InlineUtil[C <: Context with Singleton](val c: C) { } case tt: TypeTree if tt.original != null => - //super.transform(TypeTree().setOriginal(transform(tt.original))) + // super.transform(TypeTree().setOriginal(transform(tt.original))) super.transform(setOrig(c)(TypeTree(), transform(tt.original))) case _ => super.transform(tree) diff --git a/macros/src/main/scala-3/io/github/metarank/cfor/package.scala b/macros/src/main/scala-3/io/github/metarank/cfor/package.scala index 8ecdb98..d29c69f 100644 --- a/macros/src/main/scala-3/io/github/metarank/cfor/package.scala +++ b/macros/src/main/scala-3/io/github/metarank/cfor/package.scala @@ -5,7 +5,7 @@ import scala.collection.immutable.NumericRange type RangeLike = Range | NumericRange[Long] type RangeElem[X <: RangeLike] = X match - case Range => Int + case Range => Int case NumericRange[Long] => Long inline def cfor[A](inline init: A)(inline test: A => Boolean, inline next: A => A)(inline body: A => Unit): Unit = @@ -17,7 +17,6 @@ inline def cfor[A](inline array: Array[A])(body: A => Unit): Unit = inline def cfor[R <: RangeLike](inline r: R)(inline body: RangeElem[R] => Unit): Unit = ${ cforRangeMacroGen('r, 'body) } - //-------------------------------------------------------------------------- // // Code from below are based on file @@ -46,7 +45,7 @@ import scala.PartialFunction.cond import scala.quoted.* private def cforImpl[R: Type](init: Expr[R], test: Expr[R => Boolean], next: Expr[R => R], body: Expr[R => Unit])(using - Quotes + Quotes ): Expr[Unit] = import quotes.reflect.* @@ -61,7 +60,7 @@ private def cforImpl[R: Type](init: Expr[R], test: Expr[R => Boolean], next: Exp end cforImpl private def cforRangeMacroGen[R <: RangeLike: Type](r: Expr[R], body: Expr[RangeElem[R] => Unit])(using - quotes: Quotes + quotes: Quotes ): Expr[Unit] = import quotes.reflect.* @@ -139,14 +138,12 @@ private object RangeForImpl: end RangeForImpl - -/** - * Equivalent to `'{ val name: A => B = $rhs; ${in('name)} }`, except when `rhs` is a function literal, then equivalent - * to `in(rhs)`. - * - * This allows inlined function arguments to perform side-effects only once before their first evaluation, while still - * avoiding the creation of closures for function literal arguments. - */ +/** Equivalent to `'{ val name: A => B = $rhs; ${in('name)} }`, except when `rhs` is a function literal, then equivalent + * to `in(rhs)`. + * + * This allows inlined function arguments to perform side-effects only once before their first evaluation, while still + * avoiding the creation of closures for function literal arguments. + */ private def letFunc[A, B, C](using Quotes)(name: String, rhs: Expr[A => B])(in: Expr[A => B] => Expr[C]): Expr[C] = import quotes.reflect.* diff --git a/macros/src/test/scala/io/github/metarank/cfor/CforTest.scala b/macros/src/test/scala/io/github/metarank/cfor/CforTest.scala index 3ea771e..7e20d3a 100644 --- a/macros/src/test/scala/io/github/metarank/cfor/CforTest.scala +++ b/macros/src/test/scala/io/github/metarank/cfor/CforTest.scala @@ -49,10 +49,10 @@ class CforTest extends AnyFlatSpec with Matchers { } it should "functions with side effects function values in cfor" in { - val b = mutable.ArrayBuffer.empty[Int] - var v = 0 + val b = mutable.ArrayBuffer.empty[Int] + var v = 0 def test: Int => Boolean = { v += 1; _ < 3 } - def incr: Int => Int = { v += 10; _ + 1 } + def incr: Int => Int = { v += 10; _ + 1 } def body: Int => Unit = { v += 100 x => { @@ -144,7 +144,7 @@ class CforTest extends AnyFlatSpec with Matchers { it should "functions with side effects in cfor(arr)" in { var sum = 0 - var v = 0 + var v = 0 val arr = Array(0, 1, 2, 3, 4) cfor(arr) { v += 100