Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class FormatOps(
implicit val clauseSiteFlags: ClauseSiteFlags =
ClauseSiteFlags(owner, isDefnSite)
val bpFlags = getBinpackSiteFlags(matchingRight(start), start, false)
if (bpFlags.scalaJsStyle) scalaJsOptCloseOnRight(start, bpFlags)
if (bpFlags.scalaJsStyle)
if (start.hasBreak) start else scalaJsOptCloseOnRight(start, bpFlags)
else if (
!start.left.is[T.RightParen] ||
!style.newlines.fold && clauseSiteFlags.dangleCloseDelim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ class FormatTokens(leftTok2tok: Map[TokenHash, Int])(val arr: Array[FT])
def next(ft: FT): FT = apply(ft, 1)

@inline
private def matching(idx: Int, token: T): FT = matchingParentheses.getOrElse(
private def matching(idx: Int, tok: => T): FT = matchingParentheses.getOrElse(
idx,
FormatTokens.throwNoToken(token, "Missing matching token index"),
FormatTokens.throwNoToken(tok, "Missing matching token index"),
)
@inline
def matchingLeft(ft: FT): FT = matching(ft.idx, ft.left)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class CommunityIntellijScalaSuite(name: String)
class CommunityIntellijScala_2024_2_Suite
extends CommunityIntellijScalaSuite("intellij-scala-2024.2") {

override protected def totalStatesVisited: Option[Int] = Some(59389248)
override protected def totalStatesVisited: Option[Int] = Some(59389246)

override protected def builds = Seq {
getBuild(
Expand Down Expand Up @@ -54,7 +54,7 @@ class CommunityIntellijScala_2024_2_Suite
class CommunityIntellijScala_2024_3_Suite
extends CommunityIntellijScalaSuite("intellij-scala-2024.3") {

override protected def totalStatesVisited: Option[Int] = Some(59604000)
override protected def totalStatesVisited: Option[Int] = Some(59603998)

override protected def builds = Seq {
getBuild(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CommunityScala2_12Suite extends CommunityScala2Suite("scala-2.12") {

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

override protected def totalStatesVisited: Option[Int] = Some(52665901)
override protected def totalStatesVisited: Option[Int] = Some(52665895)

override protected def builds =
Seq(getBuild("v2.13.14", dialects.Scala213, 1287))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ abstract class CommunityScala3Suite(name: String)

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

override protected def totalStatesVisited: Option[Int] = Some(39186562)
override protected def totalStatesVisited: Option[Int] = Some(39186514)

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

}

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

override protected def totalStatesVisited: Option[Int] = Some(42290728)
override protected def totalStatesVisited: Option[Int] = Some(42290650)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CommunitySpark3_4Suite extends CommunitySparkSuite("spark-3.4") {

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

override protected def totalStatesVisited: Option[Int] = Some(90889210)
override protected def totalStatesVisited: Option[Int] = Some(90889168)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12582,3 +12582,16 @@ object a {
1, 2, 3
)
}
<<< #4976
danglingParentheses.callSite = false
===
a(A(
b = B,
c = C
))
>>>
a(
A(
b = B,
c = C
))
Original file line number Diff line number Diff line change
Expand Up @@ -11800,3 +11800,12 @@ object a {

Seq(1, 2, 3)
}
<<< #4976
danglingParentheses.callSite = false
===
a(A(
b = B,
c = C
))
>>>
a(A(b = B, c = C))
12 changes: 12 additions & 0 deletions scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat
Original file line number Diff line number Diff line change
Expand Up @@ -12370,3 +12370,15 @@ object a {
3
)
}
<<< #4976
danglingParentheses.callSite = false
===
a(A(
b = B,
c = C
))
>>>
a(A(
b = B,
c = C
))
Original file line number Diff line number Diff line change
Expand Up @@ -12850,4 +12850,12 @@ object a {

Seq(1, 2, 3)
}

<<< #4976
danglingParentheses.callSite = false
===
a(A(
b = B,
c = C
))
>>>
a(A(b = B, c = C))
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
val explored = Debug.explored.get()
logger.debug(s"Total explored: $explored")
if (!onlyUnit && !onlyManual)
assertEquals(explored, 2597948, "total explored")
assertEquals(explored, 2598232, "total explored")
if (!sys.env.contains("CI")) PlatformFileOps.writeFileAsync(
FileOps.getPath("target", "index.html"),
Report.heatmap(debugResults.result()),
Expand Down
Loading