diff options
-rw-r--r-- | script/core/diagnostics/undefined-field.lua | 6 | ||||
-rw-r--r-- | script/utility.lua | 3 | ||||
-rw-r--r-- | script/vm/compiler.lua | 2 | ||||
-rw-r--r-- | script/vm/runner.lua | 2 | ||||
-rw-r--r-- | test/diagnostics/common.lua | 11 |
5 files changed, 14 insertions, 10 deletions
diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua index b03838fd..a83241f5 100644 --- a/script/core/diagnostics/undefined-field.lua +++ b/script/core/diagnostics/undefined-field.lua @@ -35,10 +35,10 @@ return function (uri, callback) if node then local ok for view in vm.getInfer(node):eachView(uri) do - if not skipCheckClass[view] then - ok = true - break + if skipCheckClass[view] then + return end + ok = true end if not ok then return diff --git a/script/utility.lua b/script/utility.lua index 57511dce..bb858699 100644 --- a/script/utility.lua +++ b/script/utility.lua @@ -652,9 +652,6 @@ function m.trim(str, mode) end function m.expandPath(path) - if type(path) ~= 'string' then - return nil - end if path:sub(1, 1) == '~' then local home = getenv('HOME') if not home then -- has to be Windows diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index b7e394ae..c47c41a2 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1240,7 +1240,7 @@ local compilerSwitch = util.switch() end end end - if src.value and guide.isLiteral(src.value) then + if src.value then if src.value.type == 'table' then vm.setNode(src, vm.createNode(src.value), true) else diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 2de06aaa..3ee718b3 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -57,7 +57,7 @@ function mt:_collect() end table.sort(self._objs, function (a, b) - return (a.range or a.finish) < (b.range or b.start) + return (a.range or a.start) < (b.range or b.start) end) end diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua index 32c496df..4edb9703 100644 --- a/test/diagnostics/common.lua +++ b/test/diagnostics/common.lua @@ -1008,8 +1008,8 @@ local v ---@type Bar local v2 <!v2!> = v -v2:<!method1!>() -v2:method2() +v2:method1() +v2:<!method2!>() ]] TEST [[ @@ -1613,3 +1613,10 @@ local function foo(x) end foo(f()) ]] + +TEST [[ +---@type string|table +local n + +print(n.x) +]] |