Right now, the following cases cannot be handled by the purity analysis.
Calling dtype, is_list_like, _recurse or fspath will result in an UnknownCall being added as a reason for impurity.
# Case 1
import np
dtype = np.dtype(dtype)
import lib
is_list_like = lib.is_list_like
# Case 2
def _replace_dtype_fields_recursive(dtype, primitive_dtype):
"Private function allowing recursion in _replace_dtype_fields."
_recurse = _replace_dtype_fields_recursive
...
# Case 3
# inside os module
if not _exists('fspath'):
fspath = _fspath
fspath.__name__ = "fspath"
def _fspath(path):
"""Return the path representation of a path-like object."""
...
In case 1 the called symbol is an alias for an imported function.
In case 2 the called symbol is a "private" alias inside the function to enable recursion.
In case 3 the function is renamed and then called via its alias.
Desired solution
To increase the precision of the purity analysis, these cases should be considerate in more depth.
This could be done by implementing an alias analysis into the purity analysis, which can identify pairs of variables and fields which are referencing the same object and therefore can be treated as aliases.
Is your feature request related to a problem?
Right now, the following cases cannot be handled by the purity analysis. Calling
dtype
,is_list_like
,_recurse
orfspath
will result in anUnknownCall
being added as a reason for impurity.In case 1 the called symbol is an alias for an imported function. In case 2 the called symbol is a "private" alias inside the function to enable recursion. In case 3 the function is renamed and then called via its alias.
Desired solution
To increase the precision of the purity analysis, these cases should be considerate in more depth. This could be done by implementing an alias analysis into the purity analysis, which can identify pairs of variables and fields which are referencing the same object and therefore can be treated as aliases.
Possible alternatives (optional)
No response
Screenshots (optional)
No response
Additional Context (optional)
These examples were collected by manually analyzing the reasons for the function
safeds.data.tabular.containers._table.from_csv_file
. Manual_reasons_analysis_for-safeds.data.tabular.containers._table.from_csv_file.xlsx