Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormatOps: fix verticalMultiline.arityThreshold #3511

Merged
merged 2 commits into from
Mar 15, 2023
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 @@ -1299,20 +1299,19 @@ class FormatOps(
Seq(slbSplit, noSplit.andPolicy(noSlbPolicy), nlSplit)
} else {
val rightIsImplicit = r.is[soft.ImplicitOrUsing]
val nlOnly =
if (rightIsImplicit)
style.newlines.forceBeforeImplicitParamListModifier
else
style.verticalMultiline.newlineAfterOpenParen
val implicitNL = rightIsImplicit &&
style.newlines.forceBeforeImplicitParamListModifier
val implicitParams =
if (!rightIsImplicit) Nil
else getImplicitParamList(ft.meta.rightOwner).getOrElse(Nil)
val noSlb = nlOnly || aboveArityThreshold || ft.hasBreak &&
val noSlb = implicitNL || aboveArityThreshold || ft.hasBreak &&
!style.newlines.sourceIgnored && style.optIn.configStyleArguments ||
implicitParams.nonEmpty &&
style.newlines.forceAfterImplicitParamListModifier
val nlMod = NewlineT(alt = if (nlOnly) None else Some(slbSplit.modExt))
val spaceImplicit = !nlOnly && implicitParams.lengthCompare(1) > 0 &&
val nlNoAlt = implicitNL ||
!rightIsImplicit && style.verticalMultiline.newlineAfterOpenParen
val nlMod = NewlineT(alt = if (nlNoAlt) None else Some(slbSplit.modExt))
val spaceImplicit = !implicitNL && implicitParams.lengthCompare(1) > 0 &&
style.newlines.notBeforeImplicitParamListModifier
Seq(
// If we can fit all in one block, make it so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,25 @@ object a {
F.mkRef(Map.empty[Key, Item]).map(new Dummy.Impl(_))
)
}
<<< #3509 1
verticalMultiline.arityThreshold = 5
verticalMultiline.newlineAfterOpenParen = true
===
object Log {
def redactIds(s: String): String = s.replaceAll("\\d{5,}", "<redacted>")
}
>>>
object Log {
def redactIds(s: String): String = s.replaceAll("\\d{5,}", "<redacted>")
}
<<< #3509 2
verticalMultiline.arityThreshold = 5
verticalMultiline.newlineAfterOpenParen = false
===
object Log {
def redactIds(s: String): String = s.replaceAll("\\d{5,}", "<redacted>")
}
>>>
object Log {
def redactIds(s: String): String = s.replaceAll("\\d{5,}", "<redacted>")
}