lua-language-server icon indicating copy to clipboard operation
lua-language-server copied to clipboard

@generic return ignores question mark

Open semushin-s opened this issue 1 year ago • 0 comments

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Type Checking

Expected Behaviour

Type of y in example below is integer?

Actual Behaviour

Type of y in example below is integer

Reproduction steps

---@generic T
---@param test T
---@return T?
function Func(test)
end

--- @return integer?
function Func2()
end

local x = 0
local y = Func(x)
local z = Func2()

Additional Notes

T | nil works as a workaround. image

Log File

No response

semushin-s avatar Dec 05 '23 15:12 semushin-s