Convenience method for testing that type inference works

Given the importance of type inference for performance, perhaps we should check that it hasn't been broken for particular functions.

CC @JeffBezanson, @simonster.