Skip to content

Commit

Permalink
State: don't penalize punct overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 9, 2024
1 parent 6b7752e commit d5ae62f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ final case class State(
val ok = delayedPenalty != 0 ||
style.newlines.avoidForSimpleOverflowPunct &&
column >= style.maxColumn
if (ok) result(1, prevActive)
if (ok) result(0, prevActive)
else prev.getOverflowPenalty(split, defaultOverflowPenalty + 1)
} else if (
style.newlines.avoidForSimpleOverflowSLC &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ newlines.avoidForSimpleOverflow = [punct]
}
}
}}}
>>> { stateVisits = 1262, stateVisits2 = 1259 }
>>> { stateVisits = 1126, stateVisits2 = 1123 }
{
{
{
Expand Down
23 changes: 12 additions & 11 deletions scalafmt-tests/shared/src/test/resources/scalajs/DefDef.stat
Original file line number Diff line number Diff line change
Expand Up @@ -531,15 +531,15 @@ newlines.avoidForSimpleOverflow = [tooLong, punct, slc]
object a {
implicit def fromFunction17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R](f: scala.Function17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R]): js.Function17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] = (x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) => f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)
}
>>>
>>> { stateVisits = 1015, stateVisits2 = 472 }
object a {
implicit def fromFunction17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
T13, T14, T15, T16, T17, R](
f: scala.Function17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
T13, T14, T15, T16, T17, R]): js.Function17[T1, T2, T3, T4, T5, T6, T7,
T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, R] = (x1: T1, x2: T2,
x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10,
x11: T11, x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) =>
f: scala.Function17[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T14, T15, T16, T17, R]): js.Function17[T1, T2, T3, T4, T5, T6, T7, T8,
T9, T10, T11, T12, T13, T14, T15, T16, T17, R] = (x1: T1, x2: T2, x3: T3,
x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10, x11: T11,
x12: T12, x13: T13, x14: T14, x15: T15, x16: T16, x17: T17) =>
f(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17)
}
<<< break at maxColumn, with overflow enabled 1
Expand Down Expand Up @@ -616,8 +616,9 @@ object a {
>>>
object a {
@inline implicit def fromScalaTuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
T11, T12, T13](t: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13))
: js.Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13] =
T11, T12, T13](
t: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)
): js.Tuple13[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13] =
apply(t._1, t._2, t._3, t._4, t._5, t._6, t._7, t._8, t._9, t._10, t._11,
t._12, t._13)
}
Expand All @@ -635,9 +636,9 @@ object a {
>>>
object a {
@inline implicit def fromScalaTuple18[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,
T11, T12, T13, T14, T15, T16, T17, T18](t: (T1, T2, T3, T4, T5, T6, T7,
T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18)): js.Tuple18[T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18] =
T11, T12, T13, T14, T15, T16, T17, T18](t: (T1, T2, T3, T4, T5, T6, T7, T8,
T9, T10, T11, T12, T13, T14, T15, T16, T17, T18)): js.Tuple18[T1, T2,
T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18] =
apply(t._1, t._2, t._3, t._4, t._5, t._6, t._7, t._8, t._9, t._10, t._11,
t._12, t._13, t._14, t._15, t._16, t._17, t._18)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
override def afterAll(): Unit = {
logger.debug(s"Total explored: ${Debug.explored}")
if (!onlyUnit && !onlyManual)
assertEquals(Debug.explored, 1777077, "total explored")
assertEquals(Debug.explored, 1776701, "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 d5ae62f

Please sign in to comment.