summaryrefslogtreecommitdiff
path: root/test/crossfile/diagnostic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/crossfile/diagnostic.lua')
-rw-r--r--test/crossfile/diagnostic.lua71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/crossfile/diagnostic.lua b/test/crossfile/diagnostic.lua
index dd06351f..126a2ab8 100644
--- a/test/crossfile/diagnostic.lua
+++ b/test/crossfile/diagnostic.lua
@@ -8,6 +8,7 @@ local catch = require 'catch'
config.get(nil, 'Lua.diagnostics.neededFileStatus')['deprecated'] = 'Any'
config.get(nil, 'Lua.diagnostics.neededFileStatus')['type-check'] = 'Any'
+config.get(nil, 'Lua.diagnostics.neededFileStatus')['duplicate-set-field'] = 'Any'
config.get(nil, 'Lua.diagnostics.neededFileStatus')['codestyle-check'] = 'None'
rawset(_G, 'TEST', true)
@@ -140,3 +141,73 @@ TEST {
content = 'require "f.a"',
},
}
+
+TEST {
+ { path = 'a.lua', content = [[
+ ---@class A
+ ---@field package x string
+
+ ---@type A
+ local obj
+
+ print(obj.x)
+ ]]},
+}
+
+TEST {
+ { path = 'a.lua', content = [[
+ ---@class A
+ ---@field package x string
+ ]]},
+ { path = 'b.lua', content = [[
+ ---@type A
+ local obj
+
+ print(obj.<!x!>)
+ ]]}
+}
+
+TEST {
+ { path = 'a.lua', content = [[
+ ---@class A
+ ---@field <!x!> number
+ ]]},
+ { path = 'b.lua', content = [[
+ ---@class A
+ ---@field <!x!> number
+ ]]}
+}
+
+TEST {
+ { path = 'a.lua', content = [[
+ ---@class A
+ local mt
+
+ function <!mt:init!>()
+ end
+ ]]},
+ { path = 'b.lua', content = [[
+ ---@class A
+ local mt
+
+ function <!mt:init!>()
+ end
+ ]]}
+}
+
+TEST {
+ { path = 'a.lua', content = [[
+ ---@class A
+ local mt
+
+ function mt:init()
+ end
+ ]]},
+ { path = 'b.lua', content = [[
+ ---@class B: A
+ local mt
+
+ function mt:init()
+ end
+ ]]}
+}