Skip to main content

check_s7_dispatch

Function check_s7_dispatch 

Source
fn check_s7_dispatch(parsed: &ParsedImpl) -> Result<()>
Expand description

Validate the S7 dispatch arguments of every S7 instance method: an explicit s7(dispatch = "..."), and the pair S7 fixes for an Ops / %*% operator generic (e1, e2 / x, y).

S7 registers a method only when its formals start with the generic’s dispatch arguments, in order and without defaults, and it rejects the wrong number of classes in the signature; any violation stops the package from loading. The generator names the receiver after the first dispatch argument and takes the others from the method’s leading parameters, so the rules are checked here, where the error can name the fix. ! is rejected outright because S7 does not dispatch it. Non-S7 class systems, static methods and property accessors are a no-op.