Commit b91e6990 authored by Martin Bauer's avatar Martin Bauer
Browse files

Correct automatic typing (double/bool) also for staggered kernels

parent 4cdd0ad7
......@@ -216,8 +216,9 @@ def create_staggered_kernel(staggered_field, expressions, subexpressions=(), tar
for d in dimensions])
sp_assignments = [SympyAssignment(a.lhs, a.rhs) for a in a_coll.all_assignments]
if as_else_block and last_conditional:
last_conditional.false_block = Conditional(condition, Block(sp_assignments))
last_conditional = last_conditional.false_block
new_cond = Conditional(condition, Block(sp_assignments))
last_conditional.false_block = Block([new_cond])
last_conditional = new_cond
last_conditional = Conditional(condition, Block(sp_assignments))
......@@ -923,8 +923,13 @@ def typing_from_sympy_inspection(eqs, default_type="double"):
result = defaultdict(lambda: default_type)
for eq in eqs:
if isinstance(eq, ast.Node):
if isinstance(eq, ast.Conditional):
if eq.false_block:
elif isinstance(eq, ast.Node) and not isinstance(eq, ast.SympyAssignment):
# problematic case here is when rhs is a symbol: then it is impossible to decide here without
# further information what type the left hand side is - default fallback is the dict value then
if isinstance(eq.rhs, Boolean) and not isinstance(eq.rhs, sp.Symbol):
Markdown is supported
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