Status/Resolution/Reason: Needs Review//Investigate
Reporter/Name(from Bugbase): Bryan Henderson / Bryan Henderson ()
Created: 06/21/2017
Components: Language
Versions: 2016
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 2016,0,03,301771 /
Priority/Frequency: Normal / All users will encounter
Locale/System: / Win 2012 Server x64
Vote Count: 8
Problem Description:
When a variable is defined, but contains a value that equates to boolean false, the Elvis operator (?:) incorrectly resolves to the expression on the right.
Steps to Reproduce:
{code:java}
local.vals = [0, false, "no", JavaCast("null", "")];
writeDump(local.vals.map(function(val){return arguments.val ?: true;}));
{code}
Actual Result:
array 
1: true 
2: true 
3: true 
4: true 
Expected Result:
array 
1: 0 
2: false 
3: no 
4: true 
Any Workarounds:
none while still using the elvis operator.
  Attachments:
Comments: