From 35746c2d90db7c62b0fba2186537a12bd5eb6012 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Fri, 6 May 2022 14:45:05 +0200
Subject: [PATCH] Treat R^1x1 the same way as R^1 when initializing with 0

---
 src/language/utils/AffectationProcessorBuilder.hpp     | 5 +++--
 tests/test_ASTNodeListAffectationExpressionBuilder.cpp | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/language/utils/AffectationProcessorBuilder.hpp b/src/language/utils/AffectationProcessorBuilder.hpp
index 0e4b7ace6..4c489e726 100644
--- a/src/language/utils/AffectationProcessorBuilder.hpp
+++ b/src/language/utils/AffectationProcessorBuilder.hpp
@@ -17,9 +17,10 @@ class AffectationProcessorBuilder final : public IAffectationProcessorBuilder
   std::unique_ptr<INodeProcessor>
   getNodeProcessor(ASTNode& lhs_node, ASTNode& rhs_node) const final
   {
-    if constexpr (std::is_same_v<ValueT, TinyVector<1>> and std::is_same_v<DataT, int64_t> and
+    if constexpr ((std::is_same_v<ValueT, TinyVector<1>> or
+                   std::is_same_v<ValueT, TinyMatrix<1>>)and std::is_same_v<DataT, int64_t> and
                   std::is_same_v<OperatorT, language::eq_op>) {
-      // Special treatment for the case 0 -> R^1
+      // Special treatment for the case 0 -> R^1 or 0 -> R^1x1
       if ((rhs_node.is_type<language::integer>()) and (std::stoi(rhs_node.string()) == 0)) {
         return std::make_unique<AffectationFromZeroProcessor<ValueT>>(lhs_node);
       } else {
diff --git a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp
index 8d495053e..7210b65f2 100644
--- a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp
+++ b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp
@@ -239,7 +239,7 @@ let (x1,x2,x3,x) : R^1x1*R^2x2*R^3x3*R,
 
       std::string_view result = R"(
 (root:ASTNodeListProcessor)
- +-(language::eq_op:AffectationProcessor<language::eq_op, TinyMatrix<1ul, 1ul, double>, long>)
+ +-(language::eq_op:AffectationFromZeroProcessor<TinyMatrix<1ul, 1ul, double> >)
  |   +-(language::name:a:NameProcessor)
  |   `-(language::integer:0:ValueProcessor)
  +-(language::eq_op:AffectationToTinyMatrixFromListProcessor<language::eq_op, TinyMatrix<2ul, 2ul, double> >)
-- 
GitLab