You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Let function signature hook have context of caller #14845
Actual argument types are passed to the function hook, but then it's too late since arguments were already checked, and the hook can only affect the callee's return type.
I'm not sure what's the best approach:
Add equivalent of CheckerPluginInterface.accept for ad-hoc type resolution (i.e. current solution but w/o private API). The assumption is that this will not normally be used by hook authors except in specific cases for specific args (since doing it generally creates a chicken-and-egg problem, as infer_arg_types_in_context gets the callee after the hook's mutation).
Pass actual arg types to function sig hook. Not sure it'll be doable, since as I mentioned infer_arg_types_in_context depends on callee (after hook's mutation).
Change function hook to allow returning not only a ret_type but also arg_types/kinds/names. This means that in those cases checks will be done twice: it first has to pass old formal sig, then (if plugin returns one) it has to pass the new formal sig.
Activity
ikonst commentedon Mar 7, 2023
Notably, for method signature hooks there's
MethodSigContext.typethat is a piece of caller context.ikonst commentedon Mar 7, 2023
Hmpf, I forgot there was an issue: #10216
Add get_expression_type to CheckerPluginInterface (#15369)
Add signature for dataclasses.replace (#14849)