Our compiler check that looks for arrays relying on the old ref-by-default behavior and warning that const is the new default and that an explicit ref should be added to maintain the old behavior seems to be incorrect when an array argument is passed by varargs. This was masked before by the fact that the compiler would pass all arrays to iterators by ref, but now that it's not, such cases get incorrectly flagged.
I thought that this might happen when an array was passed to an iterator in a tuple argument as well, but that did not seem to be the case.
Here's an example:
iter I(i...?k) {
for param d in 0..<k {
for b in i(d) {
yield b;
}
}
}
var A = [0, 1, 2, 3, 4];
var res = (I(A) == 2);
This is a reasonably low-priority issue because I think we could probably remove the warning at any point now since it's on by default and has been out for two releases. That said, since we're flagging new cases in #28935, we now should probably leave it in for another release or two in case people have code that trips it.