Skip to content

Type inference by literal index #574

Closed
@Cassolette

Description

@Cassolette

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions