@@ -2866,27 +2866,29 @@ TEST_F(FormatTest, ShortEnums) {
28662866}
28672867
28682868TEST_F(FormatTest, ShortCompoundRequirement) {
2869+ constexpr StringRef Code("template <typename T>\n"
2870+ "concept c = requires(T x) {\n"
2871+ " { x + 1 } -> std::same_as<int>;\n"
2872+ "};");
2873+
28692874 FormatStyle Style = getLLVMStyle();
28702875 EXPECT_TRUE(Style.AllowShortCompoundRequirementOnASingleLine);
2871- verifyFormat("template <typename T>\n"
2872- "concept c = requires(T x) {\n"
2873- " { x + 1 } -> std::same_as<int>;\n"
2874- "};",
2875- Style);
2876+ verifyFormat(Code, Style);
28762877 verifyFormat("template <typename T>\n"
28772878 "concept c = requires(T x) {\n"
28782879 " { x + 1 } -> std::same_as<int>;\n"
28792880 " { x + 2 } -> std::same_as<int>;\n"
28802881 "};",
28812882 Style);
2883+
28822884 Style.AllowShortCompoundRequirementOnASingleLine = false;
28832885 verifyFormat("template <typename T>\n"
28842886 "concept c = requires(T x) {\n"
28852887 " {\n"
28862888 " x + 1\n"
28872889 " } -> std::same_as<int>;\n"
28882890 "};",
2889- Style);
2891+ Code, Style);
28902892 verifyFormat("template <typename T>\n"
28912893 "concept c = requires(T x) {\n"
28922894 " {\n"
@@ -2897,6 +2899,11 @@ TEST_F(FormatTest, ShortCompoundRequirement) {
28972899 " } -> std::same_as<int>;\n"
28982900 "};",
28992901 Style);
2902+
2903+ Style.AllowShortCompoundRequirementOnASingleLine = true;
2904+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
2905+ Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_MultiLine;
2906+ verifyFormat(Code, Style);
29002907}
29012908
29022909TEST_F(FormatTest, ShortCaseLabels) {
0 commit comments