Make it illegal to call dimension() on an array node.

Also implement properly dimension() for random access nodes.
Support arrays with heterogenous dimension.