Fix bug in type checking of typed first-order representation.

Involves adding a type annotation to NewArray constructor, among other things.