Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Analyze super() expressions more precisely #7232
Thanks for the updates! Based on a quick pass, this looks pretty solid.
It would be nice if you could split the long method into at least a few smaller ones, however, before a full review. Generally smaller methods that do one thing make things easier to understand and modify, in my experience. This is up to you though. One idea is to extract some (smaller) parts into helper methods. Another idea would be to split it into 2 or more big methods that are invoked in sequence, similar to the original implementation. What do you think?
Great! Looks good now!
Note that our recommended workflow is to push additional commits to a branch instead of force pushing an amended commit to make it easier to review incremental changes to a PR.
@msullivan Do you have an example? There is e.g. the test case
[case testSuperWithAny] class B: def f(self) -> None: pass class C(B): def h(self, x) -> None: reveal_type(super(x, x).f) # N: Revealed type is 'def ()' reveal_type(super(C, x).f) # N: Revealed type is 'def ()' reveal_type(super(C, type(x)).f) # N: Revealed type is 'def (self: __main__.B)'