Skip to content

Commit a16aec3

Browse files
committed
FormatOps: slb ends before ) for cfg-style
1 parent 696ef4a commit a16aec3

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatOps.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ class FormatOps(
8383
implicit val clauseSiteFlags: ClauseSiteFlags =
8484
ClauseSiteFlags(owner, isDefnSite)
8585
val bpFlags = getBinpackSiteFlags(matchingRight(start), start, false)
86-
if (bpFlags.scalaJsStyle) scalaJsOptCloseOnRight(start, bpFlags)
86+
if (bpFlags.scalaJsStyle)
87+
if (start.hasBreak) start else scalaJsOptCloseOnRight(start, bpFlags)
8788
else if (
8889
!start.left.is[T.RightParen] ||
8990
!style.newlines.fold && clauseSiteFlags.dangleCloseDelim

scalafmt-core/shared/src/main/scala/org/scalafmt/internal/FormatTokens.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ class FormatTokens(leftTok2tok: Map[TokenHash, Int])(val arr: Array[FT])
7676
def next(ft: FT): FT = apply(ft, 1)
7777

7878
@inline
79-
private def matching(idx: Int, token: T): FT = matchingParentheses.getOrElse(
79+
private def matching(idx: Int, tok: => T): FT = matchingParentheses.getOrElse(
8080
idx,
81-
FormatTokens.throwNoToken(token, "Missing matching token index"),
81+
FormatTokens.throwNoToken(tok, "Missing matching token index"),
8282
)
8383
@inline
8484
def matchingLeft(ft: FT): FT = matching(ft.idx, ft.left)

scalafmt-tests-community/intellij/shared/src/test/scala/org/scalafmt/community/intellij/CommunityIntellijScalaSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ abstract class CommunityIntellijScalaSuite(name: String)
1313
class CommunityIntellijScala_2024_2_Suite
1414
extends CommunityIntellijScalaSuite("intellij-scala-2024.2") {
1515

16-
override protected def totalStatesVisited: Option[Int] = Some(59389248)
16+
override protected def totalStatesVisited: Option[Int] = Some(59389246)
1717

1818
override protected def builds = Seq {
1919
getBuild(
@@ -54,7 +54,7 @@ class CommunityIntellijScala_2024_2_Suite
5454
class CommunityIntellijScala_2024_3_Suite
5555
extends CommunityIntellijScalaSuite("intellij-scala-2024.3") {
5656

57-
override protected def totalStatesVisited: Option[Int] = Some(59604000)
57+
override protected def totalStatesVisited: Option[Int] = Some(59603998)
5858

5959
override protected def builds = Seq {
6060
getBuild(

scalafmt-tests-community/scala2/shared/src/test/scala/org/scalafmt/community/scala2/CommunityScala2Suite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CommunityScala2_12Suite extends CommunityScala2Suite("scala-2.12") {
1818

1919
class CommunityScala2_13Suite extends CommunityScala2Suite("scala-2.13") {
2020

21-
override protected def totalStatesVisited: Option[Int] = Some(52665901)
21+
override protected def totalStatesVisited: Option[Int] = Some(52665895)
2222

2323
override protected def builds =
2424
Seq(getBuild("v2.13.14", dialects.Scala213, 1287))

scalafmt-tests-community/scala3/shared/src/test/scala/org/scalafmt/community/scala3/CommunityScala3Suite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ abstract class CommunityScala3Suite(name: String)
99

1010
class CommunityScala3_2Suite extends CommunityScala3Suite("scala-3.2") {
1111

12-
override protected def totalStatesVisited: Option[Int] = Some(39186562)
12+
override protected def totalStatesVisited: Option[Int] = Some(39186514)
1313

1414
override protected def builds = Seq(getBuild("3.2.2", dialects.Scala32, 791))
1515

1616
}
1717

1818
class CommunityScala3_3Suite extends CommunityScala3Suite("scala-3.3") {
1919

20-
override protected def totalStatesVisited: Option[Int] = Some(42290728)
20+
override protected def totalStatesVisited: Option[Int] = Some(42290650)
2121

2222
override protected def builds = Seq(getBuild("3.3.3", dialects.Scala33, 861))
2323

scalafmt-tests-community/spark/shared/src/test/scala/org/scalafmt/community/spark/CommunitySparkSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class CommunitySpark3_4Suite extends CommunitySparkSuite("spark-3.4") {
1717

1818
class CommunitySpark3_5Suite extends CommunitySparkSuite("spark-3.5") {
1919

20-
override protected def totalStatesVisited: Option[Int] = Some(90889210)
20+
override protected def totalStatesVisited: Option[Int] = Some(90889168)
2121

2222
override protected def builds = Seq(getBuild("v3.5.3", dialects.Scala213, 2756))
2323

scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12380,6 +12380,5 @@ a(A(
1238012380
>>>
1238112381
a(A(
1238212382
b = B,
12383-
c =
12384-
C
12383+
c = C
1238512384
))

scalafmt-tests/shared/src/test/scala/org/scalafmt/FormatTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
148148
val explored = Debug.explored.get()
149149
logger.debug(s"Total explored: $explored")
150150
if (!onlyUnit && !onlyManual)
151-
assertEquals(explored, 2598230, "total explored")
151+
assertEquals(explored, 2598232, "total explored")
152152
if (!sys.env.contains("CI")) PlatformFileOps.writeFileAsync(
153153
FileOps.getPath("target", "index.html"),
154154
Report.heatmap(debugResults.result()),

0 commit comments

Comments
 (0)