From 492fb30a9da935fe0273201de79e90b1eb1ae338 Mon Sep 17 00:00:00 2001
From: zy69guqi <richard.angersbach@fau.de>
Date: Mon, 31 Mar 2025 13:53:34 +0200
Subject: [PATCH] Adapt error messages for reduced assignments in freeze.py

---
 src/pystencils/backend/kernelcreation/freeze.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pystencils/backend/kernelcreation/freeze.py b/src/pystencils/backend/kernelcreation/freeze.py
index 5cdb3864c..9dc3928b3 100644
--- a/src/pystencils/backend/kernelcreation/freeze.py
+++ b/src/pystencils/backend/kernelcreation/freeze.py
@@ -200,7 +200,8 @@ class FreezeExpressions:
         orig_lhs_symb = lhs.symbol
         dtype = lhs.dtype
 
-        assert isinstance(dtype, PsNumericType)
+        assert isinstance(dtype, PsNumericType), \
+            "Reduction assignments require type information of the lhs symbol."
 
         # replace original symbol with pointer-based type used for export
         orig_lhs_symb_as_ptr = PsSymbol(orig_lhs_symb.name, PsPointerType(dtype))
@@ -226,7 +227,7 @@ class FreezeExpressions:
             case ReductionOp.Max:
                 init_val = PsCall(PsMathFunction(NumericLimitsFunctions.Min), [])
             case _:
-                raise FreezeError(f"Unsupported reduced assignment: {op}.")
+                raise FreezeError(f"Unsupported kind of reduction assignment: {op}.")
 
         reduction_info = ReductionInfo(op, init_val, orig_lhs_symb_as_ptr)
 
-- 
GitLab