diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index 0f807ebe51..1177bb5266 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -728,6 +728,7 @@ RUN(NAME symbolics_14 LABELS cpython_sym c_sym llvm_sym NOFAST) RUN(NAME test_gruntz LABELS cpython_sym c_sym llvm_sym NOFAST) RUN(NAME symbolics_15 LABELS c_sym llvm_sym NOFAST) RUN(NAME symbolics_16 LABELS cpython_sym c_sym llvm_sym NOFAST) +RUN(NAME symbolics_17 LABELS cpython_sym c_sym llvm_sym NOFAST) RUN(NAME sizeof_01 LABELS llvm c EXTRAFILES sizeof_01b.c) diff --git a/integration_tests/symbolics_17.py b/integration_tests/symbolics_17.py new file mode 100644 index 0000000000..74494e8049 --- /dev/null +++ b/integration_tests/symbolics_17.py @@ -0,0 +1,10 @@ +from lpython import S +from sympy import Symbol, pi + +def test_main(): + x: S = Symbol('x') + if x != pi: + print(x != pi) + assert x != pi + +test_main() \ No newline at end of file diff --git a/src/libasr/pass/replace_symbolic.cpp b/src/libasr/pass/replace_symbolic.cpp index f85bfde582..96a1469765 100644 --- a/src/libasr/pass/replace_symbolic.cpp +++ b/src/libasr/pass/replace_symbolic.cpp @@ -698,7 +698,9 @@ class ReplaceSymbolicVisitor : public PassUtils::PassVisitorm_left, s->m_right); } - xx.m_test = function_call; + ASR::stmt_t* stmt = ASRUtils::STMT(ASR::make_If_t(al, xx.base.base.loc, function_call, + xx.m_body, xx.n_body, xx.m_orelse, xx.n_orelse)); + pass_result.push_back(al, stmt); } }