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

bug[next]: Improve error message on invalid call to field operator and program #1323

Merged
merged 4 commits into from
Jan 22, 2024

Conversation

tehrengruber
Copy link
Contributor

After #1275 most of the error message given to the user when calling a field operator or program with invalid arguments was only available in verbose mode. This PR shows this information again.

@field_operator
def foo(x: IField):
    return x

@field_operator
def testee(a: IField, b: IField, c: IField) -> IField:
    return foo(1)
gt4py.next.errors.exceptions.DSLError: Invalid argument types in call to `foo`.
E           Invalid call to function of type `FieldOperatorType(definition=FunctionType(pos_only_args=[], pos_or_kw_args={'x': FieldType(dims=[Dimension(value='IDim', kind=<DimensionKind.HORIZONTAL: 'horizontal'>)], dtype=ScalarType(kind=<ScalarKind.INT32: 32>, shape=None))}, kw_only_args={}, returns=FieldType(dims=[Dimension(value='IDim', kind=<DimensionKind.HORIZONTAL: 'horizontal'>)], dtype=ScalarType(kind=<ScalarKind.INT32: 32>, shape=None))))`:
E             - Expected argument `x` to be of type `Field[[IDim], int32]`, but got `int32`.
E             File ".../gt4py_functional/tests/next_tests/integration_tests/feature_tests/ffront_tests/test_arg_call_interface.py", line 113
E                       return foo(1)

@tehrengruber tehrengruber requested a review from petiaccja August 16, 2023 09:04
@havogt havogt changed the title bug[next]: Improve error message on invalid call to field operator and program bug[next] Improve error message on invalid call to field operator and program Aug 17, 2023
@havogt havogt changed the title bug[next] Improve error message on invalid call to field operator and program bug[next]: Improve error message on invalid call to field operator and program Aug 17, 2023
Copy link
Contributor

@egparedes egparedes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving because it's a very small fix with potentially high quality of life improvement for some users in the short term. Most likely this should be revisited according to the recent work on standardizing our conventions to communicate errors to users. Mentioning @DropD here just to make sure he is aware of the change in this PR.

@tehrengruber tehrengruber merged commit e20294e into GridTools:main Jan 22, 2024
19 checks passed
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

Successfully merging this pull request may close these issues.

2 participants