Fix issues in determining return type of sum/prod along dim

- Fix reductions along dimensions of Union typed arrays
- sumabs/sumabs2 for Complex64/Complex128 should return Float32/Float64
Merge pull request #7539 from JuliaLang/sjk/reducedim_type

Fix issues in determining return type of sum/prod along dim