Skip to content

Diagnostics for class array #1721

Open
Open
@loneguardian

Description

@loneguardian

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

When a class is matched with its array it should produce a diagnostic error.

Actual Behaviour

No diagnostic error is produced when a class array is matched with a class.

Reproduction steps

  1. Paste the following code:
---@class classA
local a

---@type classA[]
local b

---@param param1 classA[]
---@return classA
local function testFunc(param1)
    param1 = a
    return b
end

local result = testFunc(a)
  1. Assigning param1, returning b and calling testFunc with a should all produce diagnostic errors, but no diagnostic error is produced.

Additional Notes

Another class, such as classB can be matched with classA[] without error.

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat/type checkRelated to the type checking feature

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions