Fix `ndims` for `Broadcasted` with no args (#45477)
Follow up #44061.
This PR makes `collect(Base.broadcast(randn))` works correctly, and
improve the inference result.
Test added.
---------
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Dilum Aluthge <dilum@aluthge.com>