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
In the below I am trying to set the type of the variable i in a for loop. the on-hover looks correct when done with @type, but it fails to evaluate correctly when used, however the cast works as expected.
---@class integerA : integer
local list = {} ---@type table<integerA, table>
---@type integerA
for i = 1, 10 do
list[i] = {} --- This `i` says its type integerA, however the line gives an error of "Can not infer type. LuaDiagnostics.(no-unknown)"
end
for i = 1, 10 do
---@cast i integerA
list[i] = {}
end
I believe the @type method is "better" than cast as it feels a more natural way to define its type, rather than forcing the variable to be viewed as having a set type with cast.
The text was updated successfully, but these errors were encountered:
Maybe it's somehow from my Sumneko extension settings, as I do have a fair few non default. When I'm back on the pc I shall extract and upload them.
I am running the 3.5.0 public realease.
My extension settings are below in case any are somehow relevant.
The fact I have strong enabled to flag unknown typed variables is the only one I assume is relevant given the diagnostic warning that was being raised.
In the below I am trying to set the type of the variable
i
in a for loop. the on-hover looks correct when done with @type, but it fails to evaluate correctly when used, however the cast works as expected.I believe the @type method is "better" than cast as it feels a more natural way to define its type, rather than forcing the variable to be viewed as having a set type with cast.
The text was updated successfully, but these errors were encountered: