Problem
When testing the effect of #2484 on type checking in icon4py, it appears that it enables mypy to check the arguments and return types of builtins like where. Since mypy could not trace them back to their actual definition before, it just quietly ignored them.
This leads to many ( > 100) false positives like below.
model/atmosphere/advection/src/icon4py/model/atmosphere/advection/stencils/compute_ppm4gpu_fractional_flux.py:77:19: error: Argument 1 to "__call__" of "WhereBuiltinFunction" has incompatible type "bool"; expected "Field[Any, Any]" [arg-type]
model/atmosphere/advection/src/icon4py/model/atmosphere/advection/stencils/compute_ppm4gpu_fractional_flux.py:77:30: error: Argument 2 to "__call__" of "WhereBuiltinFunction" has incompatible type "float"; expected "Field[Any, Any] | tuple[Any, ...]" [arg-type]
model/atmosphere/advection/src/icon4py/model/atmosphere/advection/stencils/compute_ppm4gpu_fractional_flux.py:77:35: error: Argument 3 to "__call__" of "WhereBuiltinFunction" has incompatible type "float"; expected "Field[Any, Any] | tuple[Any, ...]" [arg-type]
model/atmosphere/advection/src/icon4py/model/atmosphere/advection/stencils/compute_ppm4gpu_fractional_flux.py:96:85: error: Argument 3 to "__call__" of "WhereBuiltinFunction" has incompatible type "float"; expected "Field[Any, Any] | tuple[Any, ...]" [arg-type]
model/atmosphere/advection/src/icon4py/model/atmosphere/advection/stencils/compute_ppm4gpu_fractional_flux.py:99:12: error: Incompatible return value type (got "Field[Any, Any] | tuple[Any, ...]", expected "Field[Dims[Any, Any], floating[_64Bit]]") [return-value]
Solution
Options:
Problem
When testing the effect of #2484 on type checking in icon4py, it appears that it enables mypy to check the arguments and return types of builtins like
where. Since mypy could not trace them back to their actual definition before, it just quietly ignored them.This leads to many ( > 100) false positives like below.
Solution
Options: