# Does @propagate\_inbounds affect one method, or all methods (-\> the function)?

**URL:** https://discourse.julialang.org/t/does-propagate-inbounds-affect-one-method-or-all-methods-the-function/135461
**Category:** Performance
**Created:** [February 5, 2026, 3:36am UTC](https://discourse.julialang.org/t/does-propagate-inbounds-affect-one-method-or-all-methods-the-function/135461 "2026-02-05T03:36:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![marteaua](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marteaua/32/214927_2.png) [@marteaua](https://discourse.julialang.org/u/marteaua)
#### Post date: [February 5, 2026, 3:36am UTC](https://discourse.julialang.org/t/does-propagate-inbounds-affect-one-method-or-all-methods-the-function/135461/1 "2026-02-05T03:36:09Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [February 5, 2026, 6:09am UTC](https://discourse.julialang.org/t/does-propagate-inbounds-affect-one-method-or-all-methods-the-function/135461/2 "2026-02-05T06:09:00Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [February 6, 2026, 11:18am UTC](https://discourse.julialang.org/t/does-propagate-inbounds-affect-one-method-or-all-methods-the-function/135461/3 "2026-02-06T11:18:18Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [February 6, 2026, 11:24am UTC](https://discourse.julialang.org/t/does-propagate-inbounds-affect-one-method-or-all-methods-the-function/135461/4 "2026-02-06T11:24:45Z")

</div>

Ah I see there’s actually already a stalled PR for this: [improve docs for `@inbounds` and `Base.@propagate_inbounds` by aviatesk · Pull Request #50157 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/50157/changes)
