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

Type inference by literal index #574

Closed
Cassolette opened this issue Jun 23, 2021 · 0 comments
Closed

Type inference by literal index #574

Cassolette opened this issue Jun 23, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@Cassolette
Copy link
Contributor

Cassolette commented Jun 23, 2021

In the following snippet, auto completion is lost on a table after inferring its type by index

--- @diagnostic disable: unused-local
--- @class Test2
--- @field world integer
local Test2 = {}

--- @type Test2
local tdirect
--- @type Test2[]
local tarray

-- Direct inference
local b = tdirect    -- type . here, shows "world"

-- Inferred by literal index
local c = tarray[1]  -- type . here, no auto completion

When hovering it can be seen that the table loses its fields when inferred by literal index
image
image

Environment:

  • OS: Windows
  • Client: VSCode
  • Extension version: 2.0.2
@sumneko sumneko added the bug Something isn't working label Jun 24, 2021
@Cassolette Cassolette changed the title Type inference by index Type inference by literal index Jun 24, 2021
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