diff options
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') |