Thanks @John_McCall and Martin — just trying to get crystal clear now, so that I can remove all doubt.
My sense is that this scenario could be slightly different than @Joe_Groff addressed, in that he's saying an optional from the left-hand side of an assignment isn't guaranteed to be retained while the right-hand side is evaluated. As krilnon showed in the emitted SIL, while the sequence of retains and releases allows this to work (or may sometimes work) today, it isn't guaranteed.
So, is the scenario different if both references to self
appear in the same method call, as in my example?
It seems like the answer hangs on what Joe calls "the last formal use of the strong reference".
Meaning, assuming self?.someProperty
constitutes a formal use as a direct method call to the getter on self
, can self?.someProperty.someMethod()
also constitute a formal use of self
because it appears in the same expression?
Are there any references I can consult?
Thanks for the help!