Skip to content

Commit

Permalink
Update scalafmt-core to 3.5.8 (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
typelevel-steward[bot] committed Jun 10, 2022
1 parent d971e07 commit c55dab3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.5.2"
version = "3.5.8"
align.openParenCallSite = true
align.openParenDefnSite = true
maxColumn = 120
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/org/typelevel/paiges/Chunk.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private[paiges] object Chunk {
case (_, Doc.Empty) :: z => loop(pos, z)
case (i, Doc.FlatAlt(a, _)) :: z => loop(pos, (i, a) :: z)
case (i, Doc.Concat(a, b)) :: z => loop(pos, (i, a) :: (i, b) :: z)
case (i, Doc.Nest(j, d)) :: z => loop(pos, ((i + j), d) :: z)
case (i, Doc.Nest(j, d)) :: z => loop(pos, (i + j, d) :: z)
case (_, Doc.Align(d)) :: z => loop(pos, (pos, d) :: z)
case (_, Doc.Text(s)) :: z => ChunkStream.Item(s, pos + s.length, z)
case (_, Doc.ZeroWidth(s)) :: z => ChunkStream.Item(s, pos, z)
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 @@ -337,7 +337,7 @@ sealed abstract class Doc extends Product with Serializable {
case (_, Empty) :: z => loop(pos, z)
case (i, FlatAlt(a, _)) :: z => loop(pos, (i, a) :: z)
case (i, Concat(a, b)) :: z => loop(pos, (i, a) :: (i, b) :: z)
case (i, Nest(j, d)) :: z => loop(pos, ((i + j), d) :: z)
case (i, Nest(j, d)) :: z => loop(pos, (i + j, d) :: z)
case (_, Align(d)) :: z => loop(pos, (pos, d) :: z)
case (_, Text(s)) :: z => s #:: cheat(pos + s.length, z)
case (_, ZeroWidth(s)) :: z => s #:: cheat(pos, z)
Expand Down Expand Up @@ -618,7 +618,7 @@ sealed abstract class Doc extends Product with Serializable {
case (_, Empty) :: z => loop(pos, z, max)
case (i, FlatAlt(default, _)) :: z => loop(pos, (i, default) :: z, max)
case (i, Concat(a, b)) :: z => loop(pos, (i, a) :: (i, b) :: z, max)
case (i, Nest(j, d)) :: z => loop(pos, ((i + j), d) :: z, max)
case (i, Nest(j, d)) :: z => loop(pos, (i + j, d) :: z, max)
case (_, Align(d)) :: z => loop(pos, (pos, d) :: z, max)
case (_, Text(s)) :: z => loop(pos + s.length, z, max)
case (_, ZeroWidth(_)) :: z => loop(pos, z, max)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class PaigesScalacheckTest extends OurFunSuite {
}

test("concat is associative") {
forAll((a: Doc, b: Doc, c: Doc) => assertEq(((a + b) + c), (a + (b + c))))
forAll((a: Doc, b: Doc, c: Doc) => assertEq((a + b) + c, a + (b + c)))
}

test("line is associative") {
Expand Down Expand Up @@ -103,8 +103,8 @@ class PaigesScalacheckTest extends OurFunSuite {

test("empty does not change things") {
forAll { (a: Doc) =>
assertEq((a + Doc.empty), a)
assertEq((Doc.empty + a), a)
assertEq(a + Doc.empty, a)
assertEq(Doc.empty + a, a)
}
}

Expand Down Expand Up @@ -324,7 +324,7 @@ class PaigesScalacheckTest extends OurFunSuite {
def simple(n: Int, d: Doc, acc: Doc): Doc =
if (n <= 0) acc else simple(n - 1, d, acc + d)

forAll(smallTree, smallInt)((d: Doc, small: Int) => assertEq(simple(small, d, Doc.empty), (d * small)))
forAll(smallTree, smallInt)((d: Doc, small: Int) => assertEq(simple(small, d, Doc.empty), d * small))
}
test("(d * a) * b == d * (a * b)") {

Expand All @@ -337,7 +337,7 @@ class PaigesScalacheckTest extends OurFunSuite {
val smallTree = Gen.choose(0, 3).flatMap(genTree(_, withFill = true))
val smallInt = Gen.choose(0, 3)

forAll(smallTree, smallInt, smallInt)((d: Doc, a: Int, b: Int) => assertEq(((d * a) * b), (d * (a * b))))
forAll(smallTree, smallInt, smallInt)((d: Doc, a: Int, b: Int) => assertEq((d * a) * b, d * (a * b)))
}
test("text(s) * n == s * n for identifiers") {
forAll(Gen.identifier, Gen.choose(0, 20))((s, n) => assert((Doc.text(s) * n).render(0) == (s * n)))
Expand All @@ -350,7 +350,7 @@ class PaigesScalacheckTest extends OurFunSuite {
test("renderWide == render(maxWidth)") {
forAll { (d: Doc) =>
val max = d.maxWidth
assertDoc(d)(d => (d.renderWideStream.mkString == d.render(max)))
assertDoc(d)(d => d.renderWideStream.mkString == d.render(max))
}
}

Expand All @@ -362,7 +362,7 @@ class PaigesScalacheckTest extends OurFunSuite {
}

// here is a hard case:
assertEq((Doc.char('a') + Doc.char('\n')), Doc.text("a\n"))
assertEq(Doc.char('a') + Doc.char('\n'), Doc.text("a\n"))
}

test("fill matches spec") {
Expand Down

0 comments on commit c55dab3

Please sign in to comment.