From 22e988207ee11f23f66fdd157f521d2731822958 Mon Sep 17 00:00:00 2001 From: JohnnyMorganz Date: Tue, 17 May 2022 18:31:41 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Andy Friesen --- Analysis/src/ToString.cpp | 6 ++++-- tests/ToString.test.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Analysis/src/ToString.cpp b/Analysis/src/ToString.cpp index 24dbd9ad..380ac456 100644 --- a/Analysis/src/ToString.cpp +++ b/Analysis/src/ToString.cpp @@ -744,7 +744,8 @@ struct TypeVarStringifier bool first = true; for (std::string& ss : results) { - if (!first) { + if (!first) + { state.newline(); state.emit("| "); } @@ -799,7 +800,8 @@ struct TypeVarStringifier bool first = true; for (std::string& ss : results) { - if (!first) { + if (!first) + { state.newline(); state.emit("& "); } diff --git a/tests/ToString.test.cpp b/tests/ToString.test.cpp index d0508d59..f38dd10a 100644 --- a/tests/ToString.test.cpp +++ b/tests/ToString.test.cpp @@ -136,8 +136,8 @@ TEST_CASE_FIXTURE(Fixture, "intersections_respects_use_line_breaks") opts.useLineBreaks = true; //clang-format off - CHECK_EQ("((number) -> number)" - "\n& ((string) -> string)", + CHECK_EQ("((number) -> number)\n" + "& ((string) -> string)", toString(requireType("a"), opts)); //clang-format on } @@ -152,9 +152,9 @@ TEST_CASE_FIXTURE(Fixture, "unions_respects_use_line_breaks") opts.useLineBreaks = true; //clang-format off - CHECK_EQ("boolean" - "\n| number" - "\n| string", + CHECK_EQ("boolean\n" + "| number\n" + "| string", toString(requireType("a"), opts)); //clang-format on }