Bug 353758

Summary: False-positive warning for Array.prototype.reduce()
Product: [Applications] kdevelop Reporter: Francis Herne <mail>
Component: Language Support: QML/JavaScriptAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screenshot of issue

Description Francis Herne 2015-10-10 12:36:12 UTC
Created attachment 94929 [details]
Screenshot of issue

I have code:

var foo = ["aaa", "bbb", "ccc"];
foo.reduce(function(previousValue, currentValue, index, array) {
    return previousValue + currentValue;
}, "");

The area within the reduce() brackets (including the "" argument) is highlighted green with the following tooltip:

Problem in Semantic analysis:
Possible type mismatch between the argument type (function void ()) and the value passed as argument (function mixed (mixed, mixed, mixed, mixed))

Obviously the first argument to reduce() can't be void.tg
Comment 1 Kevin Funk 2017-09-15 14:55:21 UTC
Could you check if this is still valid in newer KDevelop? There's no error indicated with KDevelop 5.2 here.
Comment 2 Francis Herne 2017-09-15 15:03:00 UTC
Not reproducible for me either with 5.2.