fix #6672 (better reducedim type inference)