Implementation of type patterns for function arguments and return types, along with a notation for specifying arbitrarily complex conditions. Also works for external functions. Type patterns are not supported for specializations, or type definitions outside of function signatures.
Selection example using type patterns:
inline
int[d:shp] sel (int[vlen] idx, int[vlen:vshp,d:shp] array)
| all (0 <= idx), all (idx < vshp)
{
res = with {
(0*shp <= iv < shp)
: array[idx ++ iv];
} : genarray (shp, 0);
return res;
}
The type pattern pipeline is split into multiple steps/files:
- filter_fundef_constraints
- type_pattern_analyse
- type_pattern_resolve_(fundefs,externals)
- type_pattern_constraints
- type_pattern_guard
- strip_type_pattern_checks
- type_pattern_statistics