+1.
I also prefer the new name. if_present
is a superset of nonnull
IMO. It doesn’t make sense to keep an extra function around just as an alias.
dyn_cast_if_present
can also work on “pointer-like” types, i.e. PointerUnion
. So I don’t think it makes sense to restrict it to just pointer types. Having two functions that do the same thing also creates friction for new users who aren’t “used” to a particular thing. Which one are they supposed to use? Is this buried somewhere in the style guide? Why are there two different functions anyways?