-
-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
bugSomething isn't workingSomething isn't workingfeat/genericRelated to generic emulation featureRelated to generic emulation featurefeat/type checkRelated to the type checking featureRelated to the type checking feature
Description
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?
Annotations, Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
Actual Behaviour
Reproduction steps
---@generic T
---@param arr T[]
---@param val? T|(fun(e : T) : boolean)
---@return T? element
local function find(arr, val)
return arr[1]
end
local arr = { 'a', 'b' }
find(arr, 'b')
Additional Notes
Not sure if my annotations are wrong, but it worked in the previous version. If I change the signature so that the second parameter is T
instead of T|fun(e : T) : boolean
then it works fine.
---@generic T
---@param arr T[]
---@param val? T
---@return T? element
local function find(arr, val)
Thanks for your continued work on the language server!
Log File
Let me know if you need it.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfeat/genericRelated to generic emulation featureRelated to generic emulation featurefeat/type checkRelated to the type checking featureRelated to the type checking feature