Fix for #1563: Generic array creation

Avoid creating generic arrays and add cast or use runtime allocation if required
Addentum to #1563: optimise array type tests if possible
Updated test.src for #1563: Generic array creation
Test for #1563: Generic array creation