diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 19:09:39 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 19:09:39 +0800 |
commit | 7e778b31476831864dff995ae3ae4e5f223c5726 (patch) | |
tree | b570499b7b70014067d9e5cd737088df474b7c76 /test/diagnostics/type-check.lua | |
parent | 09cd9882be4b66f270c74516759844683832b1d4 (diff) | |
download | lua-language-server-7e778b31476831864dff995ae3ae4e5f223c5726.zip |
new diag `return-type-mismatch`
Diffstat (limited to 'test/diagnostics/type-check.lua')
-rw-r--r-- | test/diagnostics/type-check.lua | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/test/diagnostics/type-check.lua b/test/diagnostics/type-check.lua index 34f7a492..d586c5de 100644 --- a/test/diagnostics/type-check.lua +++ b/test/diagnostics/type-check.lua @@ -496,5 +496,66 @@ TEST [[ local <!x!> = 'aaa' ]] +TEST [[ +---@return number +function F() + return <!true!> +end +]] + +TEST [[ +---@return number? +function F() + return 1 +end +]] + +TEST [[ +---@return number? +function F() + return nil +end +]] + +TEST [[ +---@return number, number +local function f() end + +---@return number, boolean +function F() + return <!f()!> +end +]] + +TEST [[ +---@return boolean, number +local function f() end + +---@return number, boolean +function F() + return <!f()!> +end +]] + +TEST [[ +---@return boolean, number? +local function f() end + +---@return number, boolean +function F() + return 1, f() +end +]] + +TEST [[ +---@return number, number? +local function f() end + +---@return number, boolean, number +function F() + return 1, <!f()!> +end +]] + config.remove(nil, 'Lua.diagnostics.disable', 'unused-local') config.remove(nil, 'Lua.diagnostics.disable', 'undefined-global') |