Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbered class fields aren't typed correctly in 3.6 anymore #1677

Closed
muppet9010 opened this issue Nov 8, 2022 · 0 comments
Closed

Numbered class fields aren't typed correctly in 3.6 anymore #1677

muppet9010 opened this issue Nov 8, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@muppet9010
Copy link

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?

Type Checking

Expected Behaviour

That numbered keys of typed tables are recognised as the correct type. They where in 3.5.x, but on upgrading to 3.6 they stopped.

Actual Behaviour

3.6 complains about the type of my numbered keys. It lists the type of each numbered key as being any of the types of all my numbered keys.

Reproduction steps

When calling myFunc it should still recognise that myObject[1] is the defined type of string in the MyObject class. This ype of setup didn't complain in 3.5.x.

I have all of the Diagnostics: Group File Status set to any other than codestyle.

---@class MyObject
---@field [1] string
---@field [2] integer

---@type MyObject
local myObject = { "a", 99 }

---@param string string
---@param integer integer
local myFunc = function(string, integer)
end

myFunc(myObject[1], myObject[2])

Additional Notes

No response

Log File

No response

@sumneko sumneko added the bug Something isn't working label Nov 8, 2022
@sumneko sumneko closed this as completed in 679b32f Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants