Why is Base.return_types disables for builtin functions

Base.return_types() doesn’t work for builtin functions (https://github.com/JuliaLang/julia/blob/master/base/reflection.jl#L1077). What’s the underlying reason for this? Wrapping the builtin is a workaround, but I’m wondering when this will break. Example:

f(c, a, b) = ifelse(c, a, b)
Base.return_types(ifelse, (Bool, Int, Int)) # ArgumentError
Base.return_types(f, (Bool, Int, Int)) # [Int64]

It is a not documented and not exported method from Base, should you be relying in it?

Reflection on bulitin functions are not expected to work in general, since reflection is on generic functions (functions defined in julia) and builtins are not.

Reflections on wrapper functions are expected to work as long as the builtin still work and the reflection function still work. The wrapper function is nothing other than a normal function.

It is a not documented and not exported method from Base, should you be relying in it?

Probably shouldn’t, but at least when I wrote this code there wasn’t a public reflection API. Has that changed?

Reflection on bulitin functions are not expected to work in general, since reflection is on generic functions (functions defined in julia) and builtins are not.
Reflections on wrapper functions are expected to work as long as the builtin still work and the reflection function still work. The wrapper function is nothing other than a normal function.

I figured as much. I guess what I was getting at is the reason for why metadata for reflection isn’t added to builtin functions, more so than what the current state of things are.

I think not. The best I found is this small section of the manual: https://docs.julialang.org/en/v1/devdocs/reflection/#Reflection-and-introspection-1

There isn’t much “metadata” to be added. The reflection functions are all based on julia implementation so adding “all metadata” is basically equivalent to adding a julia implementation.

That is not to say that a limited number of reflection function couldn’t be made working. I think there might even be an issue for this but I don’t think there’s much need.