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

Added integer functions to type checking

parent 3c7f36d1
Branches
Tags
1 merge request!292Rebase of pystencils Type System
......@@ -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]
return expr.func(*new_args), bool_type
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):
# 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)))]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment