diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 0d8f01c..6667ea5 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,5 @@ # Scala Steward: Reformat with scalafmt 3.8.4 ef3e9f47047f2229b40f3a96977ebd50b92eb730 + +# Scala Steward: Reformat with scalafmt 3.11.2 +4469358ce524a3b8e0d520981990f6a777ae58a2 diff --git a/.scalafmt.conf b/.scalafmt.conf index 29f7b45..c4cc6c8 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version = "3.8.6" +version = "3.11.2" align.openParenCallSite = true align.openParenDefnSite = true maxColumn = 120 diff --git a/core/src/main/scala/org/typelevel/paiges/Chunk.scala b/core/src/main/scala/org/typelevel/paiges/Chunk.scala index afe69b8..c0e77be 100644 --- a/core/src/main/scala/org/typelevel/paiges/Chunk.scala +++ b/core/src/main/scala/org/typelevel/paiges/Chunk.scala @@ -66,7 +66,7 @@ private[paiges] object Chunk { def hasNext: Boolean = current != ChunkStream.Empty || lineCombiner.nonEmpty def next(): String = current match { - case ChunkStream.Empty => lineCombiner.finalLine() + case ChunkStream.Empty => lineCombiner.finalLine() case item: ChunkStream.Item => current = item.step lineCombiner.addItem(item).getOrElse(next()) @@ -105,7 +105,7 @@ private[paiges] object Chunk { def fits(pos: Int, d: ChunkStream): Boolean = (nonNegW >= pos) && { d match { - case ChunkStream.Empty => true + case ChunkStream.Empty => true case item: ChunkStream.Item => item.isLine || fits(item.position, item.step) } diff --git a/core/src/main/scala/org/typelevel/paiges/Doc.scala b/core/src/main/scala/org/typelevel/paiges/Doc.scala index 46d8eba..06e6784 100644 --- a/core/src/main/scala/org/typelevel/paiges/Doc.scala +++ b/core/src/main/scala/org/typelevel/paiges/Doc.scala @@ -243,7 +243,7 @@ sealed abstract class Doc extends Product with Serializable { case d1 :: tail => loop(d1, tail) case Nil => true } - case FlatAlt(a, b) => loop(a, b :: stack) + case FlatAlt(a, b) => loop(a, b :: stack) case Concat(_, Line) => false // minor optimization to short circuit sooner case Concat(a, Text(s)) => @@ -1012,7 +1012,7 @@ object Doc { } ds.toList match { - case Nil => empty + case Nil => empty case x :: ys => val (xf, xb) = x.flattenBoolean // if we don't change, the original doc is the same as flatten diff --git a/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala b/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala index fcdb17b..6839c36 100644 --- a/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala +++ b/core/src/test/scala/org/typelevel/paiges/PaigesScalacheckTest.scala @@ -386,7 +386,7 @@ class PaigesScalacheckTest extends OurFunSuite { def law(d: Doc): Boolean = d match { case Empty | Text(_) | ZeroWidth(_) | Line => true - case FlatAlt(a, b) => + case FlatAlt(a, b) => a.maxWidth <= b.maxWidth case Concat(a, b) => law(a) && law(b) @@ -405,7 +405,7 @@ class PaigesScalacheckTest extends OurFunSuite { def law(d: Doc): Boolean = d match { case Empty | Text(_) | ZeroWidth(_) | Line => true - case FlatAlt(a, b) => + case FlatAlt(a, b) => a !== b case Concat(a, b) => law(a) && law(b) @@ -425,7 +425,7 @@ class PaigesScalacheckTest extends OurFunSuite { d match { case Empty | Text(_) | ZeroWidth(_) | Line => true case FlatAlt(a, b) => !isLeft && law(a, isLeft) && law(b, isLeft) - case Concat(a, b) => + case Concat(a, b) => law(a, isLeft) && law(b, isLeft) case Union(a, b) => // we only care about the first parent of a FlatAlt node; diff --git a/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala b/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala index 00ccf3e..937fd8b 100644 --- a/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala +++ b/core/src/test/scala/org/typelevel/paiges/PaigesTest.scala @@ -53,7 +53,7 @@ object PaigesTest { @tailrec def loop(stack: List[Doc]): Boolean = stack match { - case Nil => false + case Nil => false case h :: tail => h match { case Line => true @@ -89,7 +89,7 @@ object PaigesTest { def slowRenderTrim(d: Doc, width: Int): String = { val parts = d.render(width).split("\n", -1).toList parts match { - case Nil => sys.error("unreachable") + case Nil => sys.error("unreachable") case other => other .map(str => str.reverse.dropWhile(_ == ' ').reverse) @@ -103,7 +103,7 @@ object PaigesTest { case Empty | Text(_) | ZeroWidth(_) | Line => true case FlatAlt(a, _) => twoRightAssociated(a) case Concat(Concat(Concat(_, _), _), _) => false - case Concat(a, b) => + case Concat(a, b) => twoRightAssociated(a) && twoRightAssociated(b) case Union(a, _) => twoRightAssociated(a) case f @ LazyDoc(_) => twoRightAssociated(f.evaluated) @@ -116,8 +116,8 @@ object PaigesTest { def fillSpec(sep: Doc, ds: List[Doc]): Doc = { import Doc._ ds match { - case Nil => empty - case x :: Nil => x.grouped + case Nil => empty + case x :: Nil => x.grouped case x :: y :: zs => Union(x.flatten + (sep.flatten + defer(fillSpec(sep, y.flatten :: zs))), x + (sep + defer(fillSpec(sep, y :: zs)))