Provide a way to get the inferred return type of a function

Implements Base.return_type(function, types) to get the inferred return
type of a function for a given set of input types. Type inference knows
about Base.return_type, and when the function and types are known at
compile time, the call can be eliminated entirely.