Fix vector pattern matching. Closes #6909.