Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next: Improve error on wrong field operator return type annotation #1220

Open
tehrengruber opened this issue Mar 24, 2023 · 0 comments
Open

Comments

@tehrengruber
Copy link
Contributor

If the annotated return type of a field operator does not match the deduced one, the error message should point the user to the annotation. Currently the error looks like this:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File ".../FVM_advection_sphere/src/fvm_advection_sphere/advection.py", line 337, in <module>
    def upwind_scheme(
  File ".../gt4py_functional/src/gt4py/next/ffront/decorator.py", line 637, in field_operator_inner
    return FieldOperator.from_function(definition, backend)
  File ".../gt4py_functional/src/gt4py/next/ffront/decorator.py", line 467, in from_function
    foast_definition_node = FieldOperatorParser.apply(source_def, closure_vars, annotations)
  File ".../gt4py_functional/src/gt4py/next/ffront/dialect_parser.py", line 119, in apply
    output_ast = cls._postprocess_dialect_ast(
  File ".../gt4py_functional/src/gt4py/next/ffront/func_to_foast.py", line 112, in _postprocess_dialect_ast
    raise common.GTTypeError(
gt4py.next.common.GTTypeError: Annotated return type does not match deduced return type. Expected `Field[[Vertex, K], float64]`, but got `Field[[Vertex], float64]`.
python-BaseException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant