diff --git a/src/language/node_processor/AffectationProcessor.hpp b/src/language/node_processor/AffectationProcessor.hpp index c172874b8af2bbd5408832e090ecd14492be7745..c36a747289310b6e1cd393c2a2d437c015e45d50 100644 --- a/src/language/node_processor/AffectationProcessor.hpp +++ b/src/language/node_processor/AffectationProcessor.hpp @@ -111,11 +111,11 @@ class AffectationExecutor final : public IAffectationExecutor } else { if constexpr (std::is_same_v<std::string, DataT>) { std::get<std::string>(m_lhs) += std::get<std::string>(rhs); - } else if constexpr (std::is_arithmetic_v<DataT>) { + } else if constexpr ((std::is_arithmetic_v<DataT>)and not(std::is_same_v<bool, DataT>)) { std::get<std::string>(m_lhs) += std::to_string(std::get<DataT>(rhs)); } else { std::ostringstream os; - os << std::get<DataT>(rhs); + os << std::boolalpha << std::get<DataT>(rhs); std::get<std::string>(m_lhs) += os.str(); } } diff --git a/tests/test_AffectationToStringProcessor.cpp b/tests/test_AffectationToStringProcessor.cpp index 01c7ba7b938945dc9f929f602a3fe071b052379c..73337da4ca7eb09d1adac3cf1c158787a411f495 100644 --- a/tests/test_AffectationToStringProcessor.cpp +++ b/tests/test_AffectationToStringProcessor.cpp @@ -81,8 +81,7 @@ TEST_CASE("ASTAffectationToStringProcessor", "[language]") CHECK_AFFECTATION_RESULT(R"(let n : N, n = 2; let s : string, s = "foo"; s += n;)", "s", (std::string("foo") + std::to_string(2ul))); CHECK_AFFECTATION_RESULT(R"(let s : string, s = "foo"; s += -1;)", "s", (std::string("foo") + std::to_string(-1l))); - CHECK_AFFECTATION_RESULT(R"(let s : string, s = "foo"; s += true;)", "s", - (std::string("foo") + std::to_string(true))); + CHECK_AFFECTATION_RESULT(R"(let s : string, s = "foo"; s += true;)", "s", (std::string("footrue"))); CHECK_AFFECTATION_RESULT(R"(let s : string, s = "foo"; s += 2.3;)", "s", (std::string("foo") + std::to_string(2.3))); {