Type pattern dimensionality check done too late
Dimensionality checks generated for type patterns are inserted too late into the check functions, currently it is:
assigns
dim checks
checks
But to avoid executing erroneous code in the assigns it should be:
dim checks
assigns
checks
Example:
use Array: all;
int[o] concat( int[m] x, int[n] y) | o == m+n
{
return {[i] -> x[i];
[i] -> y[i-m] | [m] <= [i] < [m+n] };
}
int[d:shp] mysel( int[n] idx, int[n:outer, d:shp] arr) | all (0 <= idx) && all (idx < outer)
{
return {iv -> _sel_VxA_ (concat (idx, iv), arr) | iv < shp};
}
int main () {
res = mysel ([1,2,2], reshape ([3,4], iota(12)));
return res;
}