Skip to main content

reject_unsupported_describe_in

Function reject_unsupported_describe_in 

Source
fn reject_unsupported_describe_in(
    methods: &[TraitMethod],
    class_system: ClassSystem,
) -> Result<()>
Expand description

Reject a method-level @describeIn that roxygen2 cannot honour on the trait wrapper (#1590), the rule ParsedImpl::reject_unsupported_describe_in applies to inherent methods.

roxygen2 lists a @describeIn block in its destination’s “Functions” section through the R object the block documents. The trait wrappers give the method’s own block such an object for S3 and vctrs instance methods (the S3 method generic.Type), S4 instance methods (the block sits on methods::setMethod(), an S4 method object), S4 static methods (the plain function Type_Trait_method) and S7 instance methods (the fast-path shortcut Type_method). Every other method is a Type$Trait$method (or .Type__Trait$method) namespace member, whose block roxygen2 drops (“Block must have a @name”), and an S7 instance method with s7(no_shortcut) has no block of its own. There the tag is a compile error pointing at @rdname, reported for every such method at once.

The set is wider than the inherent one on S4 instance methods: an inherent S4 method’s block sits on the if (!exists(...)) generic guard, a trait method’s on its own setMethod() call.