Fix type of split-at and make some vector operations use index type.

Closes PR12700.