Type stability with if statements on types

I would like to implement something to the following effect:

function f(x)
   gx = g(x)
   if g(x) isa MyType
         return gx
   else
         return 0.
   end
end

If g is type stable, if f always type stable?

yes. To test, you could use @code_warntype