Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Scala Steward: Reformat with scalafmt 3.8.4
ef3e9f47047f2229b40f3a96977ebd50b92eb730

# Scala Steward: Reformat with scalafmt 3.11.0
9ca8bbff4af912df678b021c0c6c00d19b2aa965
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.6"
version = "3.11.0"
align.openParenCallSite = true
align.openParenDefnSite = true
maxColumn = 120
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/org/typelevel/paiges/Chunk.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/org/typelevel/paiges/Doc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)) =>
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions core/src/test/scala/org/typelevel/paiges/PaigesTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)))
Expand Down
Loading