Skip to content
Snippets Groups Projects
Commit 0fc42580 authored by Markus Holzer's avatar Markus Holzer
Browse files

Added integer functions

parent 0e31ad58
No related branches found
No related tags found
No related merge requests found
Pipeline #37287 failed
...@@ -178,7 +178,13 @@ class TypeAdder: ...@@ -178,7 +178,13 @@ class TypeAdder:
new_args = [a if t.dtype_eq(bool_type) else BooleanCastFunc(a, bool_type) for a, t in args_types] new_args = [a if t.dtype_eq(bool_type) else BooleanCastFunc(a, bool_type) for a, t in args_types]
return expr.func(*new_args), bool_type return expr.func(*new_args), bool_type
elif type(expr, ) in pystencils.integer_functions.__dict__.values(): elif type(expr, ) in pystencils.integer_functions.__dict__.values():
raise NotImplementedError('integer_functions') args_types = [self.figure_out_type(a) for a in expr.args]
collated_type = collate_types([t for _, t in args_types])
# TODO: should we downcast to integer? If yes then which integer type?
if not collated_type.is_int():
raise ValueError(f"Integer functions need to be used with integer types but {collated_type} was given")
return expr, collated_type
elif isinstance(expr, flag_cond): elif isinstance(expr, flag_cond):
# do not process the arguments to the bit shift - they must remain integers # do not process the arguments to the bit shift - they must remain integers
args_types = [self.figure_out_type(a) for a in (expr.args[i] for i in range(2, len(expr.args)))] args_types = [self.figure_out_type(a) for a in (expr.args[i] for i in range(2, len(expr.args)))]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment