Fixes for record type typecode caching, and additional tests (attempt 2)

A continuation of the work/discussion from https://github.com/numba/numba/pull/879, using a dict to cache keys instead.
Ok, for now I think we can live with that reference leak :-) Perhaps adding a more verbose comment about the various constraints would be nice.