Bug 353758 - False-positive warning for Array.prototype.reduce()
Summary: False-positive warning for Array.prototype.reduce()
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: QML/JavaScript (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-10 12:36 UTC by Francis Herne
Modified: 2017-09-15 15:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot of issue (62.87 KB, image/png)
2015-10-10 12:36 UTC, Francis Herne
Details

Note You need to log in before you can comment on or make changes to this bug.
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.