version = 3.0.0
rewrite.rules = [ PreferCurlyFors ]
Steps
Given code like this:
object O {
for (pos <- "a->1|b->2".split('|'); c = pos.split("->"))
yield ()
}
When I run scalafmt like this:
scalafmt --config scalafmt.conf S.scala
Problem
Scalafmt formats code like this:
object O {
for (
pos <- "a->1|b->2".split('|')
c = pos.split("->")
)
yield ()
}
which the compiler then actually rejects:
% scalac S.scala
S.scala:4: error: value c is not a member of Array[String]
possible cause: maybe a semicolon is missing before `value c`?
c = pos.split("->")
^
1 error
Expectation
I would like the formatted output to look like this:
object O {
for {
pos <- "a->1|b->2".split('|')
c = pos.split("->")
}
yield ()
}
Steps
Given code like this:
When I run scalafmt like this:
Problem
Scalafmt formats code like this:
which the compiler then actually rejects:
Expectation
I would like the formatted output to look like this:
Notes
this came up over at https://github.com/playframework/twirl/pull/437