Simplify checkArrayTypes, add test.