tracker issue : CF-4205247

select a category, or use search below
(searches all categories and all time range)

Parsing error with fat arrow UDFs without body curlies

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Bradley W. / ()

Created: 09/24/2019

Components: Language, Closures

Versions: 2018

Failure Type: Crash

Found In Build/Fixed In Build: Update 5 / CF2018U6

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Platforms All

Vote Count: 1

Problem Description:

Passing a fat arrow UDF into a BIF with no curly braces around the body causes a parsing error.

Steps to Reproduce:

myArr = [3,3,3]
writeDump( myArr.reduce( (acc,x) => acc+x, 0 ) )

Actual Result:

Parameter validation error for the reduce function.  The function accepts 1 to 2 parameter(s).
Improper parsing of closure

Expected Result:


Any Workarounds:

Add curly braces to the function body like so:

myArr = [3,3,3]
writeDump( myArr.reduce( (acc,x) => { return acc+x }, 0 ) )



Here's a set of tests that show all known bugs in Lucee and Adobe CF's fat arrow functions along with a reference implementation in JS where everything passes.
Comment by Bradley W.
31382 | September 25, 2019 04:32:40 PM GMT
Hi All, This issue is fixed now. Please reach out to ColdFusion support @ [|] to get the patch. -Nimit
Comment by Nimit S.
31461 | September 29, 2019 05:36:00 PM GMT