Skip to content
Snippets Groups Projects

Fix typing of constants

Merged Daniel Bauer requested to merge hyteg/pystencils:bauerd/fix-const-typing into backend-rework
1 unresolved thread
1 file
+ 9
2
Compare changes
  • Side-by-side
  • Inline
@@ -126,8 +126,15 @@ class TypeContext:
@@ -126,8 +126,15 @@ class TypeContext:
raise TypificationError(
raise TypificationError(
f"Can't typify constant with non-numeric type {self._target_type}"
f"Can't typify constant with non-numeric type {self._target_type}"
)
)
c.apply_dtype(self._target_type)
if c.dtype is None:
c.apply_dtype(self._target_type)
 
elif deconstify(c.dtype) != self._target_type:
 
raise TypificationError(
 
f"Type mismatch at constant {c}: Constant type did not match the context's target type\n"
 
f" Constant type: {c.dtype}\n"
 
f" Target type: {self._target_type}"
 
)
 
case PsSymbolExpr(symb):
case PsSymbolExpr(symb):
symb.apply_dtype(self._target_type)
symb.apply_dtype(self._target_type)
Loading