Commit 51aec33 1 parent 3a5636d commit 51aec33 Copy full SHA for 51aec33
File tree 7 files changed +34
-22
lines changed
scalafmt-core/shared/src/main/scala/org/scalafmt/internal
scalafmt-tests/shared/src/test
7 files changed +34
-22
lines changed Original file line number Diff line number Diff line change @@ -2003,12 +2003,10 @@ object SplitsAfterLeftParen extends Splits {
2003
2003
else alignIndents,
2004
2004
))
2005
2005
}
2006
- def withCond (t : Tree .WithCond ) =
2007
- if (isTokenHeadOrBefore(left, t)) None else impl(isEnclosedInBraces(t.cond))
2008
2006
leftOwner match { // If/For/While/For with (
2009
2007
case t : Term .EnumeratorsBlock if getHeadOpt(t).contains(ft) => impl(false )
2010
- case t : Term . If => withCond(t)
2011
- case t : Term . While => withCond(t )
2008
+ case t : Tree . WithCond if ! isTokenHeadOrBefore(left, t) =>
2009
+ impl(isEnclosedInBraces(t.cond) )
2012
2010
case _ => None
2013
2011
}
2014
2012
}
Original file line number Diff line number Diff line change @@ -12093,7 +12093,9 @@ def foo = {
12093
12093
def foo = {
12094
12094
next.offset = begCharOffset
12095
12095
do putCharAndNext()
12096
- while (ch != CR && ch != LF && ch != FF && ch != SU)
12096
+ while (
12097
+ ch != CR && ch != LF && ch != FF && ch != SU
12098
+ )
12097
12099
}
12098
12100
<<< `do` starts a new statement, wide, danglingParentheses.ctrlSite
12099
12101
maxColumn = 60
Original file line number Diff line number Diff line change @@ -11319,8 +11319,10 @@ def foo = {
11319
11319
>>>
11320
11320
def foo = {
11321
11321
next.offset = begCharOffset
11322
- do putCharAndNext() while (ch != CR &&
11323
- ch != LF && ch != FF && ch != SU)
11322
+ do putCharAndNext() while (
11323
+ ch != CR && ch != LF && ch != FF &&
11324
+ ch != SU
11325
+ )
11324
11326
}
11325
11327
<<< `do` starts a new statement, wide, danglingParentheses.ctrlSite
11326
11328
maxColumn = 60
@@ -11334,8 +11336,9 @@ def foo = {
11334
11336
>>>
11335
11337
def foo = {
11336
11338
next.offset = begCharOffset
11337
- do putCharAndNext()
11338
- while (ch != CR && ch != LF && ch != FF && ch != SU)
11339
+ do putCharAndNext() while (
11340
+ ch != CR && ch != LF && ch != FF && ch != SU
11341
+ )
11339
11342
}
11340
11343
<<< `do` starts a new statement, narrow, !danglingParentheses.ctrlSite
11341
11344
danglingParentheses.ctrlSite = false
@@ -11348,8 +11351,9 @@ def foo = {
11348
11351
>>>
11349
11352
def foo = {
11350
11353
next.offset = begCharOffset
11351
- do putCharAndNext() while (ch != CR &&
11352
- ch != LF && ch != FF && ch != SU)
11354
+ do putCharAndNext()
11355
+ while (ch != CR && ch != LF &&
11356
+ ch != FF && ch != SU)
11353
11357
}
11354
11358
<<< `do` starts a new statement, wide, !danglingParentheses.ctrlSite
11355
11359
maxColumn = 60
Original file line number Diff line number Diff line change @@ -11865,7 +11865,9 @@ def foo = {
11865
11865
def foo = {
11866
11866
next.offset = begCharOffset
11867
11867
do putCharAndNext()
11868
- while (ch != CR && ch != LF && ch != FF && ch != SU)
11868
+ while (
11869
+ ch != CR && ch != LF && ch != FF && ch != SU
11870
+ )
11869
11871
}
11870
11872
<<< `do` starts a new statement, wide, danglingParentheses.ctrlSite
11871
11873
maxColumn = 60
Original file line number Diff line number Diff line change @@ -12350,8 +12350,9 @@ def foo = {
12350
12350
>>>
12351
12351
def foo = {
12352
12352
next.offset = begCharOffset
12353
- do putCharAndNext()
12354
- while (ch != CR && ch != LF && ch != FF && ch != SU)
12353
+ do putCharAndNext() while (
12354
+ ch != CR && ch != LF && ch != FF && ch != SU
12355
+ )
12355
12356
}
12356
12357
<<< `do` starts a new statement, narrow, !danglingParentheses.ctrlSite
12357
12358
danglingParentheses.ctrlSite = false
@@ -12364,10 +12365,9 @@ def foo = {
12364
12365
>>>
12365
12366
def foo = {
12366
12367
next.offset = begCharOffset
12367
- do putCharAndNext() while (
12368
- ch != CR && ch != LF && ch != FF &&
12369
- ch != SU
12370
- )
12368
+ do putCharAndNext()
12369
+ while (ch != CR && ch != LF &&
12370
+ ch != FF && ch != SU)
12371
12371
}
12372
12372
<<< `do` starts a new statement, wide, !danglingParentheses.ctrlSite
12373
12373
maxColumn = 60
Original file line number Diff line number Diff line change @@ -2480,9 +2480,15 @@ object a {
2480
2480
>>>
2481
2481
object a {
2482
2482
do foo
2483
- while (true)
2483
+ while (
2484
+ true
2485
+ )
2484
2486
do a + b
2485
- while (true)
2487
+ while (
2488
+ true
2489
+ )
2486
2490
do a + b
2487
- while (true)
2491
+ while (
2492
+ true
2493
+ )
2488
2494
}
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions {
148
148
val explored = Debug .explored.get()
149
149
logger.debug(s " Total explored: $explored" )
150
150
if (! onlyUnit && ! onlyManual)
151
- assertEquals(explored, 2551504 , " total explored" )
151
+ assertEquals(explored, 2552242 , " total explored" )
152
152
// TODO(olafur) don't block printing out test results.
153
153
TestPlatformCompat .executeAndWait(PlatformFileOps .writeFile(
154
154
FileOps .getPath(" target" , " index.html" ),
You can’t perform that action at this time.
0 commit comments