Impement S7_user_frame() and S7_generic_call()#681
Conversation
These are not exactly symmetric, but I think they solve the common cases, and the implementation is general enough that we can expand in the future if we discover the need. Fixes #662
t-kalinowski
left a comment
There was a problem hiding this comment.
I pushed a failing regression test for this case: same-generic nested calls are not super redispatches.
Right now we can false positive in detecting super() redispatch for an ordinary nested call to the same generic, e.g. a method calling foo("inner"), currently gets treated like foo(super(...)) because the caller’s parent is the same generic. As a result, S7_generic_call() reports the outer call and S7_user_frame() returns the outer caller frame, instead of the inner generic call and the method frame that invoked it.
|
Ooh, good catch! |
| frame | ||
| } | ||
|
|
||
| # S7_dispatch() marks the generic's frame with `_dispatched_super` when it |
There was a problem hiding this comment.
I'm not sure I love this approach, but it feels safer than either trying to inspect the generic call for calls or super(), or evaluating each of the arguments to the generic to see if they have class S7_super.
t-kalinowski
left a comment
There was a problem hiding this comment.
Defining a sentinel value in the generic frame seems fine for now, until a more elegant solution emerges. However, with the current implementation, we walk past all super frames, even those for another method. I pushed a test (currently failing) covering the case of a method calling another method with super.
|
@t-kalinowski do you want to just finish this off? It seems a bit pointless for you to make a failing test and then for me to tell claude to fix it 😆 |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
Thanks! Happy to. I pushed a change. Github won't let me request a review from the original author (you). Can you please take a look? |
These are not exactly symmetric, but I think they solve the common cases, and the implementation is general enough that we can expand in the future if we discover the need.
Fixes #596