diff options
Diffstat (limited to 'test/diagnostics')
-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 |