diff options
-rw-r--r-- | script/core/diagnostics/redundant-parameter.lua | 4 | ||||
-rw-r--r-- | test/diagnostics/init.lua | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/script/core/diagnostics/redundant-parameter.lua b/script/core/diagnostics/redundant-parameter.lua index b25ec77a..8176f0af 100644 --- a/script/core/diagnostics/redundant-parameter.lua +++ b/script/core/diagnostics/redundant-parameter.lua @@ -74,6 +74,10 @@ return function (uri, callback) local cache = vm.getCache 'redundant-parameter' guide.eachSourceType(ast.ast, 'call', function (source) + -- parameters be expanded by iterator + if source.node.iterator then + return + end local callArgs = countCallArgs(source) if callArgs == 0 then return diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua index 344c554f..54951b33 100644 --- a/test/diagnostics/init.lua +++ b/test/diagnostics/init.lua @@ -1116,3 +1116,14 @@ end return mt ]] + +TEST [[ +local function each() + return function () + end +end + +for x in each() do + print(x) +end +]] |