-
-
Notifications
You must be signed in to change notification settings - Fork 369
Open
Labels
enhancementNew feature or requestNew feature or requestfeat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)Related to Lua Language Server Annotations (LuaCats)feat/genericRelated to generic emulation featureRelated to generic emulation feature
Description
Below, I have a generic list that uses fluid interface to return itself for some methods:
--- @class List
local List = {}
--- @generic T : List, V, _
--- @param self T<V, _>
--- @param value V # Element value to insert
--- @return T<V, _> # Returning itself (a generic)
function List:insert(value)
return self -- Returning itself (a generic)
end
-- test
---@type List<number, nil>
local mylist
local testingType = mylist:insert(1)
-- ^ Testing type is not `List<number, nil>` but literally `T<V, _>`
Expected behavior
testingType is of type List<number, nil>
I am thinking that this case could be something to look at for the 3.0 update.
(Edit: perfect #1000th issue...)
Mayron, s1n7ax and FlynnLies
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)Related to Lua Language Server Annotations (LuaCats)feat/genericRelated to generic emulation featureRelated to generic emulation feature