Skip to content

Comments

Make Mapper.map_ methods take expr as positional only#221

Merged
inducer merged 3 commits intoinducer:mainfrom
alexfikl:mapper-positional-only
Oct 30, 2025
Merged

Make Mapper.map_ methods take expr as positional only#221
inducer merged 3 commits intoinducer:mainfrom
alexfikl:mapper-positional-only

Conversation

@alexfikl
Copy link
Collaborator

Came up in inducer/loopy#966 where doing the trick with

map_type_cast: Callable[[Self, TypeCast], Set[str]] = map_constant

only works if the parent class takes the expr argument as positional only. At least I get an error like

loopy/loopy/symbolic.py:1210:5 - error: Method "map_type_cast" overrides class "CombineMapper" in an incompatible manner
Parameter 2 mismatch: base parameter "expr" is keyword parameter, override parameter is position-only (reportIncompatibleMethodOverride)

This updates the base mappers to make the expr positional. Hopefully it doesn't break anything (?).

@inducer
Copy link
Owner

inducer commented Oct 30, 2025

Fine by me. If it turns something into a crater, it's easy enough to revert.

Thanks!

@inducer inducer merged commit 1d1d220 into inducer:main Oct 30, 2025
10 checks passed
@alexfikl alexfikl deleted the mapper-positional-only branch October 31, 2025 07:30
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