You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
passing an argument should have no effect, and the types of nested functions should be resolved correctly
some examples:
---@genericT---@paramargT---@returnfun(): fun(): TlocalfunctionPOOL1(arg) returnfunction() returnfunction() returnargendendend-- implementing the function makes no difference for the typinglocalfunc1=POOL1(5.2) -- type is `fun(): fun(): number`localfunc2=func1(4) -- type should be `fun(): number`, instead it's `fun(): <T>` with an unresolved generic
---@classPOOL2<T>: { EnumerateActive:fun():(T,fun():T)) }---@typePOOL2<number>localheaderPool= {}
localnumber, func=headerPool:EnumerateActive()
-- number type is `number`-- func type should be `fun(): number`, instead it's `fun(): <T>` with an unresolved generic
---@aliasPOOL3<T>fun(arg: number): T, (fun():T)---@typePOOL3<number>localgetPoollocalnumber, func=getPool(3)
-- number type is `number`-- func type should be `fun(): number`, instead it's `fun(): <T>` with an unresolved generic
all 3 examples work fine if you don't pass any argument
Actual Behaviour
when an argument is passed to the outer function, the inner function doesn't have the generic resolved
if no arguments are passed (i.e. headerPool.EnumerateActive()), then they are resolved properly
the type of the argument makes no difference, and annotating the function as accepting an argument also makes no difference
interestingly, when hovering over the function itself, the tooltip does show the correctly resolved types
Reproduction steps
copy the provided snippets, and check which types the variables resolve to
Additional Notes
Tested on both VSCode and Jetbrains IDEs
The example is contrived, my real usecase is to annotate an object pool class, that allows you to acquire objects of a given (generic) type, and allows iterating over them.
I know this has worked in a past version, though I don't remember how long ago that was (several weeks or months most likely)
Log File
No response
The text was updated successfully, but these errors were encountered:
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
Expected Behaviour
passing an argument should have no effect, and the types of nested functions should be resolved correctly
some examples:
all 3 examples work fine if you don't pass any argument
Actual Behaviour
when an argument is passed to the outer function, the inner function doesn't have the generic resolved
if no arguments are passed (i.e.
headerPool.EnumerateActive()
), then they are resolved properlythe type of the argument makes no difference, and annotating the function as accepting an argument also makes no difference
interestingly, when hovering over the function itself, the tooltip does show the correctly resolved types
Reproduction steps
copy the provided snippets, and check which types the variables resolve to
Additional Notes
Tested on both VSCode and Jetbrains IDEs
The example is contrived, my real usecase is to annotate an object pool class, that allows you to acquire objects of a given (generic) type, and allows iterating over them.
I know this has worked in a past version, though I don't remember how long ago that was (several weeks or months most likely)
Log File
No response
The text was updated successfully, but these errors were encountered: