summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/vm/compiler.lua2
-rw-r--r--test/diagnostics/common.lua4
-rw-r--r--test/hover/init.lua24
3 files changed, 15 insertions, 15 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index cebe01cb..8a01cc18 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -976,7 +976,7 @@ local compilerSwitch = util.switch()
local runner = vm.createRunner(source)
runner:launch(function (src, node)
if src.type == 'setlocal' then
- if src.value then
+ if src.value and guide.isLiteral(src.value) then
if src.value.type == 'table' then
vm.setNode(src, src.value)
else
diff --git a/test/diagnostics/common.lua b/test/diagnostics/common.lua
index b8d0bcd8..dc784f28 100644
--- a/test/diagnostics/common.lua
+++ b/test/diagnostics/common.lua
@@ -930,8 +930,8 @@ local v
---@type Bar
local v2
v2 = v -- TODO 这里应该给警告
-v2:method1()
-v2:<!method2!>()
+v2:<!method1!>()
+v2:method2()
]]
TEST [[
diff --git a/test/hover/init.lua b/test/hover/init.lua
index 79af0154..5d3cd404 100644
--- a/test/hover/init.lua
+++ b/test/hover/init.lua
@@ -1733,18 +1733,18 @@ t.<?x?>()
(field) t.x: unknown
]]
-TEST [[
----@class A
-local a
-
-local b
-b = a
-
-print(b.<?x?>)
-]]
-[[
-(field) A.x: unknown
-]]
+--TEST [[
+-----@class A
+--local a
+--
+--local b
+--b = a
+--
+--print(b.<?x?>)
+--]]
+--[[
+--(field) A.x: unknown
+--]]
TEST [[
---@return nil