Closed anutosh491 closed 7 months ago
Now the ASR node we have is this
(Print
[(IntrinsicScalarFunction
SymbolicAddQ
[(Var 13 z)]
0
(Logical 4)
()
)]
()
()
)
So we are trying to print an IntrinsicScalarFunction
that is of type Logical
(and luckily as of now we don't have any other intrinsic function of logical type registered, all logical type intrinsic functions are for solving symbolic cases)
But let's say we introduce a logical intrinsic function say ListIsEmpty
which would be of type Logical
, how can we separate this from the functions (intrinsic + logical) that are serving a symbolic purpose (like SymbolicAddQ
) ?
@anutosh491 go ahead and fix this one as a high priority, so that we can enable the symbolic pass in all frontends.
This condition } else if (ASR::is_a<ASR::Logical_t>(*ASRUtils::expr_type(val))) {
must be improved to ALSO check for the node to be intrinsic symbolic.
Right below the line ASR::IntrinsicScalarFunction_t* intrinsic_func = ASR::down_cast<ASR::IntrinsicScalarFunction_t>(val);
you need to check that intrinsic_func.id
is a symbolic function. Otherwise you ignore it.
Create a function is_symbolic_intrinsic
where inside you hardwire (for now) all the symbolic intrinsic IDs.
This issue was brought up here (https://github.com/lfortran/lfortran/pull/3432#discussion_r1496328641)
We were lucky to not have encountered this issue in Lpython itself. Consider the following
So this is an example which is solved by the code in consideration https://github.com/lcompilers/lpython/blob/7796f6d91f59b38a671056cb21859c7156cd6da7/src/libasr/pass/replace_symbolic.cpp#L786-L788