diff --git a/scalafmt-tests/src/test/resources/rewrite/RedundantBraces-ParenLambdas.stat b/scalafmt-tests/src/test/resources/rewrite/RedundantBraces-ParenLambdas.stat index b82d132f87..0ca9d2aaf4 100644 --- a/scalafmt-tests/src/test/resources/rewrite/RedundantBraces-ParenLambdas.stat +++ b/scalafmt-tests/src/test/resources/rewrite/RedundantBraces-ParenLambdas.stat @@ -128,3 +128,50 @@ object a { object a { val a = b(c => d => { e; f }) } +<<< #1707 1: don't rewrite to parens if typed lambda param +override def run(args: List[String]): IO[ExitCode] = + Slf4jLogger + .create[IO] + .flatMap { implicit logger: Logger[IO] => + program + } +>>> +test does not parse +override def run(args: List[String]): IO[ExitCode] = + Slf4jLogger + .create[IO] + .flatMap(implicit logger: Logger[IO] => program) +<<< #1707 2: don't rewrite to parens if typed lambda param +def a(b: B): C[D] = + C[String].contramap[D] { i: D => + b.format(i) + } +>>> +test does not parse +def a(formatter: DateTimeFormatter): b[Instant] = + C[String].contramap[D](i: D => b.format(i)) +<<< #1707 3: rewrite to parens if typed lambda param with parens +def a(b: B): C[D] = + C[String].contramap[D] { (i: D) => + b.format(i) + } +>>> +def a(b: B): C[D] = + C[String].contramap[D]((i: D) => b.format(i)) +<<< #1707 4: rewrite to parens if multiple params +def a(b: B): C[D] = + C[String].contramap[D] { (i: D, j: Int) => + b.format(i) + } +>>> +def a(b: B): C[D] = + C[String].contramap[D]((i: D, j: Int) => b.format(i)) +<<< #1708 +danglingParentheses = false +=== +val a = b[IO]( +{ c: Int => if (d) e else f }, g) +>>> +test does not parse +val a = b[IO]( + c: Int => if (d) e else f , g)