diff options
author | NeOzay <colpaert.benoit@gmail.com> | 2024-07-23 17:14:37 +0200 |
---|---|---|
committer | NeOzay <colpaert.benoit@gmail.com> | 2024-07-23 17:14:37 +0200 |
commit | 0b8102e3774b74db5557a494567fb0a9c5da9013 (patch) | |
tree | d1f326c81c79f13ce23a91bf5f2282d5a28c134f /test/diagnostics/missing-fields.lua | |
parent | 3ce73bee997a385b5f31cd7e7474eb3e23cbbd64 (diff) | |
download | lua-language-server-0b8102e3774b74db5557a494567fb0a9c5da9013.zip |
improve missing-fields diagnostic logic
Diffstat (limited to 'test/diagnostics/missing-fields.lua')
-rw-r--r-- | test/diagnostics/missing-fields.lua | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/test/diagnostics/missing-fields.lua b/test/diagnostics/missing-fields.lua index ab87f81d..f1b1beae 100644 --- a/test/diagnostics/missing-fields.lua +++ b/test/diagnostics/missing-fields.lua @@ -231,3 +231,107 @@ local t = { y = 1, } ]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class Foo +---@field a number +---@field b number +---@field c number + +---@class Foo + +---@class Bar +---@field ba number +---@field bb number +---@field bc number + +---@class Bar +---@field bd number + +---@type Foo|Bar +local x = { + ba = 1, + bb = 2, + bc = 3, + bd = 4, +} +]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class Foo +---@field a number +---@field b number +---@field c number + +---@class Foo + +---@class Bar +---@field ba number +---@field bb number +---@field bc number + +---@class Bar +---@field bd number + +---@type Foo|Bar +local x = { + a = 1, + b = 2, + c = 3, +} +]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class Foo +---@field a number +---@field b number +---@field c number + +---@class Foo + +---@class Bar +---@field ba number +---@field bb number +---@field bc number + +---@class Bar +---@field bd number + +---@type Foo|Bar +local x = <!{ + a = 1, + b = 2, +}!> +]] + +TEST [[ +---@diagnostic disable: unused-local + +---@class Foo +---@field a number +---@field b number +---@field c number + +---@class Foo + +---@class Bar +---@field ba number +---@field bb number +---@field bc number + +---@class Bar +---@field bd number + +---@type Foo|Bar +local x = <!{ + ba = 1, + bb = 2, + bd = 4, +}!> +]]
\ No newline at end of file |