Open EmilyBourne opened 3 years ago
What if we have a python decorator that will concatenate the function name with the associated type, in order to avoid the last defined function get_imag?
What if we have a python decorator that will concatenate the function name with the associated type, in order to avoid the last defined function get_imag?
I'm not sure that we can avoid the last function no matter the name of the functions as in pyccel we always aim to have a result that can be called in the same way as the original code
Duplicate of #885
Describe the bug Interfaces in python assume that the code is the same in all languages and therefore print the body of the first
FunctionDef
with all the decorators. However the code generated by pyccel is not always the same (e.g. if the input can be either a boolean or a numeric type)To Reproduce Provide code to reproduce the behavior:
Provide the generated code, or the error message:
Expected behavior There are multiple possible solutions:
np.imag(a)
for all types other thancomplex
would have to be corrected manually for every languageWe could print all function def bodies, and collect versions giving the same code:
but this code is not understood by pyccel
We could generate multiple translatable functions and a wrapper:
Language python
Additional context This is causing some of our tests to be incomplete, but the tests could also be fixed by avoiding interfaces. In an ideal world, the dtype should be a pytest parameter