File tree Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Expand file tree Collapse file tree 2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change 11local files = require ' files'
22local guide = require ' parser.guide'
33local lang = require ' language'
4+ local vm = require ' vm'
45
56return function (uri , callback )
67 local state = files .getState (uri )
@@ -23,18 +24,15 @@ return function (uri, callback)
2324 }
2425 return
2526 end
26- if source .value .type == ' nil'
27- or source .value .type == ' number'
28- or source .value .type == ' integer'
29- or source .value .type == ' boolean'
30- or source .value .type == ' table'
31- or source .value .type == ' function' then
27+ local infer = vm .getInfer (source .value )
28+ if not infer :hasClass ()
29+ and not infer :hasType ' nil'
30+ and infer :view (' any' , uri ) ~= ' any' then
3231 callback {
3332 start = source .value .start ,
3433 finish = source .value .finish ,
3534 message = lang .script .DIAG_COSE_NON_OBJECT ,
3635 }
37- return
3836 end
3937 end )
4038end
Original file line number Diff line number Diff line change @@ -333,13 +333,13 @@ TEST [[
333333local _ <close> = <!1!>
334334]]
335335
336- -- TEST [[
337- -- local _ <close> = <!''!>
338- -- ]]
339- --
340- -- TEST [[
341- -- local c <close> = <!(function () return 1 end)()!>
342- -- ]]
336+ TEST [[
337+ local _ <close> = <!''!>
338+ ]]
339+
340+ TEST [[
341+ local c <close> = <!(function () return 1 end)()!>
342+ ]]
343343
344344config .get (nil , ' Lua.diagnostics.disable' )[' unused-local' ] = true
345345TEST [[
You can’t perform that action at this time.
0 commit comments