Skip to content

Commit

Permalink
FormatOps: use optimal slb end in binpacked (...
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 2, 2024
1 parent 860c1b9 commit df38625
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1057,9 +1057,10 @@ class FormatOps(
}
val noSyntaxNL = extendsThenWith
val pnlPolicy = PenalizeAllNewlines(lastToken, 1, noSyntaxNL = noSyntaxNL)
val slbEnd = endOfSingleLineBlock(lastFt)
Seq(
Split(Space, 0)
.withSingleLine(lastToken, exclude = exclude, noSyntaxNL = noSyntaxNL)
.withSingleLine(slbEnd, exclude = exclude, noSyntaxNL = noSyntaxNL)
.orPolicy(pnlPolicy).withIndent(indent),
Split(nlMod, 0).onlyIf(nlOnelineTag != Right(false))
.preActivateFor(nlOnelineTag.left.toOption)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7340,6 +7340,5 @@ object Parsers:
>>>
object Parsers:
enum Location(inArgs: Boolean):
case InPatternArgs
extends Location(false, true,
case InPatternArgs extends Location(false, true,
true) // InParens not true, since it might be an alternative
Original file line number Diff line number Diff line change
Expand Up @@ -7060,7 +7060,6 @@ object Parsers:
>>>
object Parsers:
enum Location(inArgs: Boolean):
case InPatternArgs
extends Location(
case InPatternArgs extends Location(
false, true, true
) // InParens not true, since it might be an alternative
Original file line number Diff line number Diff line change
Expand Up @@ -7371,6 +7371,5 @@ object Parsers:
>>>
object Parsers:
enum Location(inArgs: Boolean):
case InPatternArgs
extends Location(false, true,
case InPatternArgs extends Location(false, true,
true) // InParens not true, since it might be an alternative
Original file line number Diff line number Diff line change
Expand Up @@ -7631,7 +7631,6 @@ object Parsers:
>>>
object Parsers:
enum Location(inArgs: Boolean):
case InPatternArgs
extends Location(
case InPatternArgs extends Location(
false, true, true
) // InParens not true, since it might be an alternative
3 changes: 2 additions & 1 deletion scalafmt-tests/shared/src/test/resources/unit/Comment.stat
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ object literal extends scala.Dynamic { // scalastyle:ignore
???
}
>>>
object literal extends scala.Dynamic { // scalastyle:ignore
object literal
extends scala.Dynamic { // scalastyle:ignore
???
}
<<< #1234 1: single-line
Expand Down

0 comments on commit df38625

Please sign in to comment.