8000 mypy: fix errors from stricter cgen typing by alexfikl · Pull Request #899 · inducer/loopy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mypy: fix errors from stricter cgen typing #899

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

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

alexfikl
Copy link
Contributor
@alexfikl alexfikl commented Jan 8, 2025

Added some more typing to cgen during the break that caused some errors in loopy. This preemptively fixes them :D

Comment on lines +842 to 846
assert isinstance(function_decl, FunctionDeclarationWrapper)
if not isinstance(function_body, Block):
function_body = Block([function_body])

fbody = FunctionBody(function_decl, function_body)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This if could be in cgen, but the current docs say that FunctionBody takes a block:
https://github.com/inducer/cgen/blob/738bdb6ea330de63dc1e476025b8ca693b535443/cgen/__init__.py#L992-L1006

self.get_temporary_var_declarator(codegen_state, tv))

if tv.initializer is not None:
decl = Initializer(decl, generate_array_literal(
init_decl = Initializer(decl, generate_array_literal(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is necessary because Initializer takes a Declarator, not a Generable (like the forced annotation above).

8000

@inducer inducer merged commit 82634b7 into inducer:main Jan 8, 2025
18 checks passed
@inducer
Copy link
Owner
inducer commented Jan 8, 2025

LGTM, thx!

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
0