Skip to content

Commit 39bb791

Browse files
committed
Ignore cast-local-type diagnostic for _ local
The `unused-local` diagnostic already hard-codes to exclude `_`. `cast-local-type` should also ignore `_` variables, to avoid warnings in, for example, nested loops like: ```lua for _, list in ipairs(lists) do for _, item in ipairs(list) do _, result = pcall(...) end end ```
1 parent f09aa41 commit 39bb791

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

script/core/diagnostics/cast-local-type.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ return function (uri, callback)
1616
if not loc.ref then
1717
return
1818
end
19+
if loc[1] == '_' then
20+
return
21+
end
1922
await.delay()
2023
local locNode = vm.compileNode(loc)
2124
if not locNode.hasDefined then

0 commit comments

Comments
 (0)