Insertion of conformity checks was disabled for the generated type pattern code, this should be enabled again.
Consider the checks generated for the selection function:
int[d:shp] sel (int[n] idx, int[n:outer,d:shp] arr)
If idx has length 3, but arr is only of dim 2 we have:
n = shape (idx)[0]; // n = 3
outer = take (n, shape (arr));
d = dim (arr) - n; // d = 2 - 3 = -1
shp = take (d, drop (n, shape (arr))); // we try to take -1
This would generate erroneous code. To avoid this, we need to ensure that conformity checks are inserted for these functions. No (significant) code duplication should occur because of this, because type pattern checks apply to the conformity of type patterns, whereas conformity checks apply to the conformity of primitive functions.
Closes #2364 (closed)