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

Function with generic variable return type loses typing after first return

Open vallode 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?

Linux

What is the issue affecting?

Type Checking

Expected Behaviour

ret2 in the example should be listed as string

Actual Behaviour

ret2 is listed as unknown

Reproduction steps

---@generic T
---@param arg T
---@return T ...
function GenericReturn(arg) end

local ret1, ret2 = GenericReturn("")

Additional Notes

Changing the return type to T|string correctly types the variable return but does not inherit the generic's typing.

Log File

No response

vallode avatar Apr 05 '24 18:04 vallode