tracker issue : CF-4205247

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

Parsing error with fat arrow UDFs without body curlies

| View in Tracker

Status/Resolution/Reason: To Test//Fixed

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

Created: 09/24/2019

Components: Language

Versions: 2018

Failure Type: Crash

Found In Build/Fixed In Build: Update 5 /

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:

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


Actual Result:

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

Expected Result:

9

Any Workarounds:

Add curly braces to the function body like so:

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

Attachments:

Comments:

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. https://github.com/bdw429s/CFML-lambda-fat-arrow-functions
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 @ [cfinstal@adobe.com|mailto:cfinstal@adobe.com] to get the patch. -Nimit
Comment by Nimit S.
31461 | September 29, 2019 05:36:00 PM GMT