Emit error when passing additional arguments/parameters after a params array
Consider the following code, it can be compiled successfully, but f2
will give totally wrong results. Is this because currently other arguments cannot be put after a params
array? If so, maybe a warning should be emitted?
void f1 (int index, params int[] x) {
print ("%d\n", x[index]); // output: 2
print ("%d\n", x.length); // output: 3
}
void f2 (params int[] x, int index) {
print ("%d\n", x[index]); // output: 1
print("%d\n", x.length); // output: 8
}
void main () {
f1 (1, 1, 2, 3);
f2 (1, 2, 3, 1);
}
valac version: 0.52.3
Edited by Rico Tzschichholz