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

style[next]: more strict typing #1494

Merged
merged 9 commits into from
Mar 19, 2024
Merged

Conversation

havogt
Copy link
Contributor

@havogt havogt commented Mar 15, 2024

No description provided.

@havogt havogt requested a review from egparedes March 15, 2024 09:09
@havogt havogt marked this pull request as ready for review March 15, 2024 09:09
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.

I have some comments to improve the typing fixes.

pyproject.toml Outdated Show resolved Hide resolved
src/gt4py/eve/codegen.py Show resolved Hide resolved
src/gt4py/next/embedded/common.py Outdated Show resolved Hide resolved
src/gt4py/next/embedded/operators.py Outdated Show resolved Hide resolved
src/gt4py/next/type_inference.py Outdated Show resolved Hide resolved
src/gt4py/next/embedded/context.py Outdated Show resolved Hide resolved
src/gt4py/next/errors/excepthook.py Outdated Show resolved Hide resolved
src/gt4py/next/type_system/type_info.py Outdated Show resolved Hide resolved
@havogt havogt requested a review from egparedes March 18, 2024 12:22
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.

Looks good. Final round of questions before approving.

pyproject.toml Outdated Show resolved Hide resolved
src/gt4py/next/common.py Outdated Show resolved Hide resolved
src/gt4py/next/embedded/common.py Outdated Show resolved Hide resolved
@@ -46,7 +46,7 @@ def __call__( # type: ignore[override]
self,
*args: common.Field | core_defs.Scalar,
**kwargs: common.Field | core_defs.Scalar, # type: ignore[override]
) -> common.Field:
) -> common.Field | tuple[common.Field | tuple, ...]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be something like :

Suggested change
) -> common.Field | tuple[common.Field | tuple, ...]:
) -> common.Field[Any, _R] | tuple[common.Field[Any, _R] | tuple, ...]:

to bound the _R typevar to this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

init was missing the correct typevar and here it gets a bit more complicated, see solution.

src/gt4py/next/embedded/operators.py Outdated Show resolved Hide resolved
src/gt4py/next/ffront/lowering_utils.py Show resolved Hide resolved
src/gt4py/next/iterator/embedded.py Outdated Show resolved Hide resolved
src/gt4py/next/iterator/embedded.py Outdated Show resolved Hide resolved
@havogt havogt requested a review from egparedes March 19, 2024 10:44
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.

Some of the typing ignores in return types could also be solved using cast() but it's not a big deal. ILGTM.

@havogt havogt merged commit b26e6a3 into GridTools:main Mar 19, 2024
55 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