From 1f537f5a162884299c4fd7af9243f4103c5da0fb Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Wed, 11 Jan 2023 04:52:28 -0800 Subject: [PATCH] Add test with curried params alignment --- .../resources/align/DefaultWithAlign.stat | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/scalafmt-tests/src/test/resources/align/DefaultWithAlign.stat b/scalafmt-tests/src/test/resources/align/DefaultWithAlign.stat index 622c3feaa9..f67480e07f 100644 --- a/scalafmt-tests/src/test/resources/align/DefaultWithAlign.stat +++ b/scalafmt-tests/src/test/resources/align/DefaultWithAlign.stat @@ -1876,3 +1876,156 @@ foo ++= Seq( "test", foo %%% bar % baz % "test" ) +<<< curry params after +align.tokens."+" = [{ + code = ":", + owners = [{ regex = "Term\\.Param" }] +}] +=== +object a { + def longDefNameThatCausesLinesToWrap1(x: Type0)(y: Type1)(implicit + a: Type2, + bb: Type3, + ccc: Type4, + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1(x: Type0)(y: Type1)(implicit + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1(x: Type0)(y: Type1)(implicit + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } +} +>>> +object a { + def longDefNameThatCausesLinesToWrap1(x: Type0)(y: Type1)(implicit + a: Type2, + bb: Type3, + ccc: Type4, + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1(x: Type0)(y: Type1)(implicit + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1(x: Type0)(y: Type1)(implicit + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } +} +<<< curry params before +align.tokens."+" = [{ + code = ":", + owners = [{ regex = "Term\\.Param" }] +}] +=== +object a { + def longDefNameThatCausesLinesToWrap1( + a: Type2, + bb: Type3, + ccc: Type4, + dddd: Type5, + eeeee: Type6 + )(x: Type0)(y: Type1): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + dddd: Type5, + eeeee: Type6 + )(x: Type0)(y: Type1): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + eeeee: Type6 + )(x: Type0)(y: Type1): Future[Option[ReturnType]] = { ??? } +} +>>> +object a { + def longDefNameThatCausesLinesToWrap1( + a: Type2, + bb: Type3, + ccc: Type4, + dddd: Type5, + eeeee: Type6 + )(x: Type0)(y: Type1): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + dddd: Type5, + eeeee: Type6 + )(x: Type0)(y: Type1): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + eeeee: Type6 + )(x: Type0)(y: Type1): Future[Option[ReturnType]] = { ??? } +} +<<< curry params before and after +align.tokens."+" = [{ + code = ":", + owners = [{ regex = "Term\\.Param" }] +}] +=== +object a { + def longDefNameThatCausesLinesToWrap1( + a: Type2, + bb: Type3, + ccc: Type4 + )(x: Type0)(y: Type1)( + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + eeeee: Type6 + )(x: Type0)(y: Type1)( + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } +} +>>> +object a { + def longDefNameThatCausesLinesToWrap1( + a: Type2, + bb: Type3, + ccc: Type4 + )(x: Type0)(y: Type1)( + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + eeeee: Type6 + )(x: Type0)(y: Type1)( + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } +} +<<< curry params before and after, multiline +align.multiline = true +align.tokens."+" = [{ + code = ":", + owners = [{ regex = "Term\\.Param" }] +}] +=== +object a { + def longDefNameThatCausesLinesToWrap1( + a: Type2, + bb: Type3, + ccc: Type4 + )(x: Type0)(y: Type1)( + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + eeeee: Type6 + )(x: Type0)(y: Type1)( + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } +} +>>> +object a { + def longDefNameThatCausesLinesToWrap1( + a: Type2, + bb: Type3, + ccc: Type4 + )(x: Type0)(y: Type1)( + dddd: Type5, + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } + def longDefNameThatCausesLinesToWrap1( + eeeee: Type6 + )(x: Type0)(y: Type1)( + eeeee: Type6 + ): Future[Option[ReturnType]] = { ??? } +}