Make the `getproperty` example type stable (#48004)
The example as written is not type stable, as one can verify with`@code_warntype`.
Seems worth this small change to illustrate the preferable approach.
On a more general note, I just recently figured out that `getproperty` is not type stable in general.
(Simply replace the `obj.x + 1` with something like `obj.x / 2`.)
Probably whoever reviews this PR will know that already but I wish that I had been warned long ago about that.
I would recommend that a warning be put right here in these docs for it.
I could draft the warning if there is openness to including it, but I figured that might be more debatable than the type annotation...
Co-authored-by: Shuhei Kadowaki <aviatesk@gmail.com>