improve type inference of type reflection (T.types, T.parameters)

ref #5752
Merge branch 'master' of github.com:JuliaLang/julia