diff --git a/src/language/node_processor/AffectationProcessor.hpp b/src/language/node_processor/AffectationProcessor.hpp index c58ea1670440107fadf2d350aaa75b76ae0de29f..f3f8af44f38477007a0f85b2a3ee00738a5b82c9 100644 --- a/src/language/node_processor/AffectationProcessor.hpp +++ b/src/language/node_processor/AffectationProcessor.hpp @@ -419,13 +419,16 @@ class AffectationToTupleProcessor final : public INodeProcessor } else { std::ostringstream os; os << v << std::ends; - *m_lhs = std::vector{os.str()}; + *m_lhs = std::vector<std::string>{os.str()}; } } else if constexpr (std::is_same_v<ValueT, TinyVector<1>> and std::is_arithmetic_v<T>) { - *m_lhs = std::vector{TinyVector<1>{static_cast<double>(v)}}; - } else if constexpr (is_tiny_vector_v<ValueT> and std::is_same_v<T, int64_t>) { + *m_lhs = std::vector<TinyVector<1>>{TinyVector<1>{static_cast<double>(v)}}; + } else if constexpr (std::is_same_v<ValueT, TinyVector<2>> and std::is_same_v<T, int64_t>) { Assert(v == 0); - *m_lhs = std::vector<ValueT>{zero}; + *m_lhs = std::vector<TinyVector<2>>{TinyVector<2>{zero}}; + } else if constexpr (std::is_same_v<ValueT, TinyVector<3>> and std::is_same_v<T, int64_t>) { + Assert(v == 0); + *m_lhs = std::vector<TinyVector<3>>{TinyVector<3>{zero}}; } else { // LCOV_EXCL_START throw ParseError("unexpected error: unexpected right hand side type in affectation", m_node.begin()); diff --git a/tests/test_AffectationToTupleProcessor.cpp b/tests/test_AffectationToTupleProcessor.cpp index bb7f8a29901f630f80760e92fc026a4765ba755b..3720bc856b30fa39468e90a7a56cc0ce2d01058d 100644 --- a/tests/test_AffectationToTupleProcessor.cpp +++ b/tests/test_AffectationToTupleProcessor.cpp @@ -127,6 +127,11 @@ let t :(R^2); t = (0); )", "t", (std::vector<TinyVector<2>>{TinyVector<2>{0, 0}})); + CHECK_AFFECTATION_RESULT(R"( +let t :(R^3); t = (0); +)", + "t", (std::vector<TinyVector<3>>{TinyVector<3>{0, 0, 0}})); + CHECK_AFFECTATION_RESULT(R"( let x : R^1, x = 1; let t :(R^1); t = (x,2);