The Base.@propagate_inbounds documentation says the macro affects the annotated “function”.
Does it mean that it affects all the method defined to a specific function ? Or just the annotated method?
I ask because I want to implement several Base.getindex methods for a new type, with some using @propagate_inbounds but some other not (cause they seem too long and too frequently used to me to risk inlining them everywhere).
Just the annotated method, you can see how in the @macroexpand printout. getindex methods in the wild also have their own @propagate_inbounds. It’d probably be better if it were worded as “inline a method”, but I haven’t heard of a way to register an entire generic function to be treated differently by a method-wise compiler.
This would be a great candidate for a little documentation PR to clean up the wording if you’re willing to take it on. It’s just generally a pretty terse and unhelpful docstring so should be pretty easy to cook up something better.
E.g. something along the lines of
Annotate a method definition, informing the compiler that uses of this method should be inlined while preserving the caller’s inbounds context.
And then providing some small examples that actually showcases what this means, as well as see also links to @inbounds and @inline should be quite helpful.