From 984c65394dbfdb1e084b81bebd45b1684eb1510a Mon Sep 17 00:00:00 2001 From: Mario Kruselj Date: Mon, 3 Nov 2025 16:09:27 +0100 Subject: [PATCH] abs, sgn and signbit support arrays as argument Previously if you tried abs(foo[1]), compiler would error out. But this construct is supported in vanilla KSP, so support it in sKSP as well! --- compiler/ksp_compiler_extras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ksp_compiler_extras.py b/compiler/ksp_compiler_extras.py index 951b689..0c11ef2 100644 --- a/compiler/ksp_compiler_extras.py +++ b/compiler/ksp_compiler_extras.py @@ -296,7 +296,7 @@ def visitFunctionCall(self, parent, node, *args): if not is_text: # special case: these three functions return an integer or real depending on what param type is given - if function_name in ('abs', 'sgn', 'signbit') and passed_param.type in ('integer', 'real'): + if function_name in ('abs', 'sgn', 'signbit') and passed_param.type in ('integer', 'real', 'integer array', 'real array'): node.type = passed_param.type elif 'any-array-variable' in param_descriptor: if not passed_param.type in ('integer array', 'real array', 'string array'):