diff options
Diffstat (limited to 'test/diagnostics/param-type-mismatch.lua')
-rw-r--r-- | test/diagnostics/param-type-mismatch.lua | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/test/diagnostics/param-type-mismatch.lua b/test/diagnostics/param-type-mismatch.lua index b11068db..bb602cab 100644 --- a/test/diagnostics/param-type-mismatch.lua +++ b/test/diagnostics/param-type-mismatch.lua @@ -264,3 +264,87 @@ local function f(v) end f 'x' f 'y' ]] + +TEST [[ +---@class A +---@field x string +---@field y number + +local a = {x = "", y = 0} + +---@param a A +function f(a) end + +f(a) +]] + +TEST [[ +---@class A +---@field x string +---@field y number + +local a = {x = ""} + +---@param a A +function f(a) end + +f(<!a!>) +]] + +TEST [[ +---@class A +---@field x string +---@field y number + +local a = {x = "", y = ""} + +---@param a A +function f(a) end + +f(<!a!>) +]] + +TEST [[ +---@class A +---@field x string +---@field y? B + +---@class B +---@field x string + +local a = {x = "b", y = {x = "c"}} + +---@param a A +function f(a) end + +f(a) +]] + +TEST [[ +---@class A +---@field x string +---@field y B + +---@class B +---@field x string + +local a = {x = "b", y = {}} + +---@param a A +function f(a) end + +f(<!a!>) +]] + +TEST [[ +---@class A +---@field x string + +---@type A +local a = {} + +---@param a A +function f(a) end + +f(a) +]]
\ No newline at end of file |