summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoruhziel <uhziel@gmail.com>2020-12-14 10:59:47 +0800
committeruhziel <uhziel@gmail.com>2020-12-14 10:59:47 +0800
commitcbacf3202f6162073aad1433ef0197b7b16f79bc (patch)
treeafae7cee7ad1218eb4394eb1ef599fcfc83976bf /test
parent9043c7d15b8fc71c509946b4eb03320f7b2d6595 (diff)
downloadlua-language-server-cbacf3202f6162073aad1433ef0197b7b16f79bc.zip
处理"当会推导成多个class类型时"的情况
Diffstat (limited to 'test')
-rw-r--r--test/diagnostics/init.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/diagnostics/init.lua b/test/diagnostics/init.lua
index b923b8b6..35342dcf 100644
--- a/test/diagnostics/init.lua
+++ b/test/diagnostics/init.lua
@@ -922,3 +922,22 @@ function mt:method1()
return <!self.method2!>() -- doc.class.name
end
]]
+
+-- checkUndefinedField 当会推导成多个class类型时
+TEST [[
+---@class Foo
+local mt
+function mt:method1() end
+
+---@class Bar
+local mt2
+function mt2:method2() end
+
+---@type Foo
+local v
+---@type Bar
+local v2
+v2 = v
+v2:method1()
+v2:method2() -- 这个感觉实际应该报错更合适
+]]