diff --git a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala index fc954c900..7ae607da4 100644 --- a/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala +++ b/scalafmt-core/shared/src/main/scala/org/scalafmt/internal/Router.scala @@ -938,8 +938,9 @@ class Router(formatOps: FormatOps) { val spacePolicy = SingleLineBlock(lambdaToken) ==> { def before = Policy.End < close ==> Policy.on(close, "NODANGLE") { case Decision(FormatToken(bc, `close`, _), _) => - val isSpace = bc.is[T.Comment] || style.spaces.inParentheses - Seq(Split(Space(isSpace), 0)) + if (bc.is[T.Comment]) + if (bc.text.startsWith("//")) Nil else Seq(Split(Space, 0)) + else Seq(Split(Space(style.spaces.inParentheses), 0)) } Policy ? lambdaIsABlock || Policy.RelayOnSplit.by(Policy.End == lambdaLeft.getOrElse(close))( diff --git a/scalafmt-tests/shared/src/test/resources/rewrite/AvoidInfix.stat b/scalafmt-tests/shared/src/test/resources/rewrite/AvoidInfix.stat index c9554b375..e31367ff2 100644 --- a/scalafmt-tests/shared/src/test/resources/rewrite/AvoidInfix.stat +++ b/scalafmt-tests/shared/src/test/resources/rewrite/AvoidInfix.stat @@ -837,10 +837,6 @@ newlines.avoidForSimpleOverflow = all def templates = symbols.filter (x => x.isClass || x.isTrait || x == AnyRefClass// which is now a type alias */ ).toSet >>> -test does not parse: [dialect scala213] `)` expected but `end of file` found -def templates = symbols.filter(x => x.isClass || x.isTrait || x == AnyRefClass // which is now a type alias */ ) - .toSet -^ -====== full result: ====== -def templates = symbols.filter(x => x.isClass || x.isTrait || x == AnyRefClass // which is now a type alias */ ) - .toSet +def templates = symbols.filter(x => + x.isClass || x.isTrait || x == AnyRefClass // which is now a type alias */ +).toSet diff --git a/scalafmt-tests/shared/src/test/scala/org/scalafmt/FormatTests.scala b/scalafmt-tests/shared/src/test/scala/org/scalafmt/FormatTests.scala index 8bb76762d..b83b21701 100644 --- a/scalafmt-tests/shared/src/test/scala/org/scalafmt/FormatTests.scala +++ b/scalafmt-tests/shared/src/test/scala/org/scalafmt/FormatTests.scala @@ -137,7 +137,7 @@ class FormatTests extends FunSuite with CanRunTests with FormatAssertions { val explored = Debug.explored.get() logger.debug(s"Total explored: $explored") if (!onlyUnit && !onlyManual) - assertEquals(explored, 1502307, "total explored") + assertEquals(explored, 1502510, "total explored") val results = debugResults.result() // TODO(olafur) don't block printing out test results. // I don't want to deal with scalaz's Tasks :'(