Skip to content

Commit

Permalink
FormatOps: remove redundant infix split
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 22, 2024
1 parent 3565a70 commit 0ddf2fe
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,9 @@ class FormatOps(
val exclude =
if (breakMany) TokenRanges.empty
else insideBracesBlock(nextFT, expire, true)
Split(ModExt(newStmtMod.getOrElse(spaceMod)), cost)
val ignore = exclude.isEmpty && singleLinePolicy.nonEmpty &&
expire.end == fullExpire.end
Split(ignore, cost)(ModExt(newStmtMod.getOrElse(spaceMod)))
.withSingleLine(expire, exclude, noOptimal = cost != 0)
}
}
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(48163081)
override protected def totalStatesVisited: Option[Int] = Some(47842614)

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

override protected def totalStatesVisited: Option[Int] = Some(48342732)
override protected def totalStatesVisited: Option[Int] = Some(48021731)

override protected def builds = Seq(getBuild(
"2024.3.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ abstract class CommunityScala2Suite(name: String)

class CommunityScala2_12Suite extends CommunityScala2Suite("scala-2.12") {

override protected def totalStatesVisited: Option[Int] = Some(35837156)
override protected def totalStatesVisited: Option[Int] = Some(35263229)

override protected def builds =
Seq(getBuild("v2.12.20", dialects.Scala212, 1277))
Expand All @@ -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(44596615)
override protected def totalStatesVisited: Option[Int] = Some(43937370)

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(33365450)
override protected def totalStatesVisited: Option[Int] = Some(32921525)

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(36011287)
override protected def totalStatesVisited: Option[Int] = Some(35521362)

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 @@ -9,7 +9,7 @@ abstract class CommunitySparkSuite(name: String)

class CommunitySpark3_4Suite extends CommunitySparkSuite("spark-3.4") {

override protected def totalStatesVisited: Option[Int] = Some(72398899)
override protected def totalStatesVisited: Option[Int] = Some(71558097)

override protected def builds =
Seq(getBuild("v3.4.1", dialects.Scala213, 2585))
Expand All @@ -18,7 +18,7 @@ class CommunitySpark3_4Suite extends CommunitySparkSuite("spark-3.4") {

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

override protected def totalStatesVisited: Option[Int] = Some(76561809)
override protected def totalStatesVisited: Option[Int] = Some(75699361)

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 @@ -69,7 +69,7 @@ private[parser] trait CacheControlHeader { this: Parser with CommonRules with Co
clearSB() ~ zeroOrMore(!'"' ~ !',' ~ qdtext ~ appendSB() | `quoted-pair`) ~ push(sb.toString)
}
}
>>> { stateVisits = 36399, stateVisits2 = 36399 }
>>> { stateVisits = 36215, stateVisits2 = 36215 }
/** Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ danglingParentheses.preset = false
===
case class AttributeInfo(symbol : Symbol, typeRef : Type, value : Option[Any],
values : Seq[String ~ Any]) // sym_Ref info_Ref {constant_Ref} {nameRef constantRef}
>>> { stateVisits = 63, stateVisits2 = 63 }
>>> { stateVisits = 62, stateVisits2 = 62 }
case class AttributeInfo(
symbol: Symbol,
typeRef: Type,
Expand Down Expand Up @@ -6779,7 +6779,7 @@ object a {
sb.append((if (lsb < 10) ('0' + lsb).asInstanceOf[Char]
else ('a' + (lsb - 10)).asInstanceOf[Char]))
}
>>> { stateVisits = 1571, stateVisits2 = 1571 }
>>> { stateVisits = 527, stateVisits2 = 527 }
object a {
sb.append((if (msb < 10) ('0' + msb).asInstanceOf[Char]
else ('a' + (msb - 10)).asInstanceOf[Char]))
Expand Down Expand Up @@ -8358,7 +8358,7 @@ object a {
)
)
}
>>> { stateVisits = 6093, stateVisits2 = 6093 }
>>> { stateVisits = 4946, stateVisits2 = 4946 }
object a {
div(cls := "cover")(
div(cls := "doc")(bodyContents),
Expand Down Expand Up @@ -8445,7 +8445,7 @@ object a {
)
)
}
>>> { stateVisits = 7564, stateVisits2 = 7564 }
>>> { stateVisits = 5051, stateVisits2 = 5051 }
object a {
div(cls := "cover")(
div(cls := "doc")(bodyContents),
Expand Down Expand Up @@ -9455,7 +9455,7 @@ object a {
}
}
}
>>> { stateVisits = 3538, stateVisits2 = 3538 }
>>> { stateVisits = 2933, stateVisits2 = 2933 }
object a {
private object MemoMap {
def make(implicit trace: Trace): UIO[MemoMap] = Ref.Synchronized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ danglingParentheses.preset = false
===
case class AttributeInfo(symbol : Symbol, typeRef : Type, value : Option[Any],
values : Seq[String ~ Any]) // sym_Ref info_Ref {constant_Ref} {nameRef constantRef}
>>> { stateVisits = 63, stateVisits2 = 63 }
>>> { stateVisits = 62, stateVisits2 = 62 }
case class AttributeInfo(
symbol: Symbol,
typeRef: Type,
Expand Down Expand Up @@ -8981,7 +8981,7 @@ object a {
)
)
}
>>> { stateVisits = 684, stateVisits2 = 684 }
>>> { stateVisits = 477, stateVisits2 = 477 }
object a {
div(cls := "cover")(
div(cls := "doc")(bodyContents),
Expand Down Expand Up @@ -9085,7 +9085,7 @@ object a {
)
)
}
>>> { stateVisits = 708, stateVisits2 = 708 }
>>> { stateVisits = 432, stateVisits2 = 432 }
object a {
div(cls := "cover")(
div(cls := "doc")(bodyContents),
Expand Down Expand Up @@ -10169,7 +10169,7 @@ object a {
}
}
}
>>> { stateVisits = 970, stateVisits2 = 970 }
>>> { stateVisits = 940, stateVisits2 = 940 }
object a {
private object MemoMap {
def make(implicit trace: Trace): UIO[MemoMap] = Ref
Expand Down Expand Up @@ -10313,7 +10313,7 @@ object a {
.map(_.filterNot(_.getCanonicalPath.contains("SSLOptions")))
}
}
>>> { stateVisits = 1168, stateVisits2 = 1168 }
>>> { stateVisits = 1162, stateVisits2 = 1162 }
object a {
private def ignoreUndocumentedPackages(
packages: Seq[Seq[File]]
Expand Down Expand Up @@ -10452,7 +10452,7 @@ object a {
.map(filterNot(getCanonicalPath.contains("SSLOptions")))
}
}
>>> { stateVisits = 739, stateVisits2 = 739 }
>>> { stateVisits = 733, stateVisits2 = 733 }
object a {
private def ignoreUndocumentedPackages(
packages: Seq[Seq[File]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5927,7 +5927,7 @@ object a:
})
index
}
>>> { stateVisits = 1513, stateVisits2 = 1513 }
>>> { stateVisits = 986, stateVisits2 = 986 }
object a:
private val packageIndex
: scala.collection.Map[String, scala.collection.Seq[Path]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,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, 1501658, "total explored")
assertEquals(explored, 1480598, "total explored")
val results = debugResults.result()
// TODO(olafur) don't block printing out test results.
// I don't want to deal with scalaz's Tasks :'(
Expand Down

0 comments on commit 0ddf2fe

Please sign in to comment.