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

Add descend_args to DependencyMapper types #158

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

alexfikl
Copy link
Collaborator

@alexfikl alexfikl commented Nov 10, 2024

This adds include_calls: bool | Literal["descend_args"] = True to DependencyMapper and a few other small typing fixes.

I think this also exposes a typing bug (the mypy CI should fail). I added missing type parameters to CachedDependencyMapper and it started complaining

pymbolic/interop/ast.py:467: error: Item "AlgebraicLeaf" of "AlgebraicLeaf | CommonSubexpression" has no attribute "name"  [union-attr]
pymbolic/interop/ast.py:467: error: Item "CommonSubexpression" of "AlgebraicLeaf | CommonSubexpression" has no attribute "name"  [union-attr]

from https://github.com/inducer/pymbolic/blob/670bbbb188d1b65a64811d401f1c3f71e99f85f6/pymbolic/interop/ast.py#L465=L466. From what I can tell, that can return things that don't have a .name attribute, so not sure what the correct types would be. Suggestions?

@alexfikl
Copy link
Collaborator Author

@inducer
Copy link
Owner

inducer commented Nov 11, 2024

From what I can tell, that can return things that don't have a .name attribute, so not sure what the correct types would be. Suggestions?

It's not clear why that specifies composite_leaves=True---I think that should only want Variables and error on any other non-composite leaves it gets.

@alexfikl
Copy link
Collaborator Author

alexfikl commented Nov 11, 2024

It's not clear why that specifies composite_leaves=True---I think that should only want Variables and error on any other non-composite leaves it gets.

Yeah, that ast interop stuff doesn't seem to be very tested or used :\ I updated it to only support vars in 222537e.

EDIT: Not sure why those failures, looks like a failed download.. I'll retry it later.

@inducer inducer merged commit a365dbf into inducer:main Nov 12, 2024
11 checks passed
@inducer
Copy link
Owner

inducer commented Nov 12, 2024

LGTM, thanks!

@alexfikl alexfikl deleted the fix-dependency-mapper-types branch November 13, 2024 07:16
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