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

Router: use implicit rule for vertical multiline #3524

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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 @@ -2427,12 +2427,11 @@ class Router(formatOps: FormatOps) {
}

case FormatToken(soft.ImplicitOrUsing(), _, ImplicitUsingOnLeft(params))
if style.binPack.unsafeDefnSite.isNever &&
!style.verticalMultiline.atDefnSite =>
if style.binPack.unsafeDefnSite.isNever =>
val spaceSplit = Split(Space, 0)
.notIf(style.newlines.forceAfterImplicitParamListModifier)
.withPolicy(
SingleLineBlock(params.tokens.last),
SingleLineBlock(params.tokens.last, rank = 1),
style.newlines.notPreferAfterImplicitParamListModifier
)
Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,178 @@ object a {
d: D,
implicit val e: E) {}
}
<<< #3520 implicitParamListModifierForce = [after], no VML
verticalMultiline.atDefnSite = no
newlines.implicitParamListModifierForce = [after]
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(a: Int)(implicit
b: Int
): Int =
a + b
def bar(a: Int)(implicit
b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierForce = [after]
newlines.implicitParamListModifierForce = [after]
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(
a: Int
)(implicit
b: Int
): Int =
a + b
def bar(
a: Int
)(implicit
b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierForce = [before], no VML
verticalMultiline.atDefnSite = no
newlines.implicitParamListModifierForce = [before]
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(a: Int)(
implicit b: Int
): Int =
a + b
def bar(a: Int)(
implicit b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierForce = [before]
newlines.implicitParamListModifierForce = [before]
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(
a: Int
)(
implicit b: Int
): Int =
a + b
def bar(
a: Int
)(
implicit b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierPrefer = after, no VML
verticalMultiline.atDefnSite = no
newlines.implicitParamListModifierPrefer = after
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit
b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierPrefer = after
newlines.implicitParamListModifierPrefer = after
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(
a: Int
)(implicit
b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierPrefer = before, no VML
verticalMultiline.atDefnSite = no
newlines.implicitParamListModifierPrefer = before
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(
implicit b: Int // c
): Int =
a + b
}
<<< #3520 implicitParamListModifierPrefer = before
newlines.implicitParamListModifierPrefer = before
===
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(a: Int)(implicit b: Int // c
): Int =
a + b
}
>>>
object Foo {
def bar(a: Int)(implicit b: Int): Int =
a + b
def bar(
a: Int
)(implicit b: Int // c
): Int =
a + b
}