Skip to content

Commit

Permalink
Fix bug with verticalMultilineAtDefinitionSite
Browse files Browse the repository at this point in the history
Fixes an issue where defaulted methods with called with () would get
split.
  • Loading branch information
pjrt committed Feb 2, 2017
1 parent 4bbaa85 commit daada22
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/scala/org/scalafmt/internal/Router.scala
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ class Router(formatOps: FormatOps) {
val oneLinePerArg = OneArgOneLineSplit(open).f
val paramGroupSplitter: PartialFunction[Decision, Decision] = {
// Indent seperators `)(` by `indentSep`
case Decision(t @ FormatToken(_, rp @ RightParen(), _), _) =>
case Decision(t @ FormatToken(_, rp @ RightParen(), _), _)
if rp == lastParen || next(t).right.is[LeftParen] =>
Decision(t,
Seq(
Split(Newline, 0)
Expand Down
18 changes: 18 additions & 0 deletions core/src/test/resources/test/VerticalMultiline.stat
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ def format_![T <: Tree](
ev2: EC
): String

<<< should work with defaulted method
def format_![T <: Tree](
name: Name,
code: String = Defaults.code, updatedAt: Instant = Instant.now(),
createdAt: Instant = Instant.now())
(implicit ev: Parse[T],
ev2: EC)
: String
>>>
def format_![T <: Tree](
name: Name,
code: String = Defaults.code,
updatedAt: Instant = Instant.now(),
createdAt: Instant = Instant.now()
)(implicit ev: Parse[T],
ev2: EC
): String

<<< should not affect classes
final class UserProfile(name: String, age: Int, address: Address, profession: Profesion, school: School)
extends Profile with UserSettings
Expand Down

0 comments on commit daada22

Please sign in to comment.