Adam Cameron
function f(required string param1, required numeric param2, ... date param3) // does not work in CF2021. Does not error, but ignores the rest operator
Repro (https://trycf.com/gist/850662c058d620ce94f39e2c7e43737b/acf2021?theme=monokai):
function f(required string param1, required numeric param2, ... date param3) {
return arguments
}
result = f("a string", 42, createDate(2011,3,24), createDate(2016, 8, 17))
writeDump(var=result, label="actual")
expected = {
param1 = "a string",
param2 = 42,
param3 = [createDate(2011,3,24), createDate(2016, 8, 17)]
}
writeDump(var=expected, label="expected")
https://i2.paste.pics/88ef751197cd12fa1ea2ed1afb7b4f88.png▾
Patrick
05/09/2022, 1:10 PMTim
05/09/2022, 2:06 PM...
) is a new syntax in CF2021.
the Rest syntax collects and condenses [iterables] into a single elementIt's supposed to take everything passed to the function starting at
...
and group them into an array referenced by param3
. It's not.Tim
05/09/2022, 2:11 PMPatrick
05/09/2022, 2:11 PMTim
05/09/2022, 2:13 PMdate
it works as expected... And similarly, if you change it to string (and change the inputs accordingly) it fails in the same way.Adam Cameron
Tim
05/09/2022, 7:12 PM