Skip to content
Snippets Groups Projects

Freeze casts of bare constants to typed PsConstantExprs

Merged Daniel Bauer requested to merge hyteg/pystencils:bauerd/cast-bare-constant into v2.0-dev
2 files
+ 23
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -29,6 +29,7 @@ from pystencils.backend.ast.expressions import (
PsGe,
PsCall,
PsCast,
PsConstantExpr,
)
from pystencils.backend.constants import PsConstant
from pystencils.backend.functions import PsMathFunction, MathFunctions
@@ -286,3 +287,6 @@ def test_cast_func():
expr = freeze(CastFunc.as_index(z))
assert expr.structurally_equal(PsCast(ctx.index_dtype, z2))
expr = freeze(CastFunc(42, create_type("int16")))
assert expr.structurally_equal(PsConstantExpr(PsConstant(42, create_type("int16"))))
Loading