Test case for #2031
Fix #2031: throw divergent array error when modifying array selected with $