[mypyc] Use native calls to singledispatch functions (#10981)
* Wrap singledispatch callable class in glue function
mypyc doesn't have support for calling callable classes without going
through the python API, so instead of having to special case the
singledispatch callable class when we want to generate a native call to
it, we create a glue function that loads the callable class from the
globals dict and then makes a native call to that callable class's
__call__ method.
* Use native calls for singledispatch functions
Use a native call to the glue function that we generate for
singledispatch functions instead of calling those singledispatch
functions through the python API.
* Add irbuild test for native calls to singledispatch functions
Add an irbuild test to make sure we use native calls to the glue
functions for singledispatch functions, and that the glue functions make
native calls to the __call__ methods on the callable classes.
* Fix irbuild test