Fix bug in assigning to struct from a scalar

The error was in the fancy logic matching up dimensions
to assign an array dim to a struct. Bounding by the
type's ndim restricts the scalar to struct assignment
case as needed.