diff --git a/src/pystencils/sympyextensions/typed_sympy.py b/src/pystencils/sympyextensions/typed_sympy.py index 509752bdf8fe0a4cca1504b703ad47e5cc2b90c1..290576368a0d24997df4af74b466c204cb9ae318 100644 --- a/src/pystencils/sympyextensions/typed_sympy.py +++ b/src/pystencils/sympyextensions/typed_sympy.py @@ -207,10 +207,11 @@ class BoolCast(TypeCast, Boolean): tcast = TypeCast -class CastFunc(sp.Function): +class CastFunc(TypeCast): def __new__(cls, *args, **kwargs): warn( "CastFunc is deprecated and will be removed in pystencils 2.1. " "Use `pystencils.tcast` instead.", FutureWarning ) + return TypeCast.__new__(cls, *args, **kwargs) diff --git a/tests/kernelcreation/test_type_cast.py b/tests/kernelcreation/test_type_cast.py index 8ad6d867042ff6e57e5baee8c12ff45bae17e8e4..6b7acbbedbe395f36f306b76eeb09b8edc7444d9 100644 --- a/tests/kernelcreation/test_type_cast.py +++ b/tests/kernelcreation/test_type_cast.py @@ -8,7 +8,7 @@ from pystencils import ( Assignment, Field, ) -from pystencils.sympyextensions.typed_sympy import CastFunc +from pystencils.sympyextensions.typed_sympy import tcast AVAIL_TARGETS_NO_SSE = [t for t in Target.available_targets() if Target._SSE not in t] @@ -55,7 +55,7 @@ def test_type_cast(gen_config, xp, from_type, to_type): inp_field = Field.create_from_numpy_array("inp", inp) outp_field = Field.create_from_numpy_array("outp", outp) - asms = [Assignment(outp_field.center(), CastFunc(inp_field.center(), to_type))] + asms = [Assignment(outp_field.center(), tcast(inp_field.center(), to_type))] kernel = create_kernel(asms, gen_config) kfunc = kernel.compile()