Skip to content

Warning is only generated for the first vararg parameter #3340

@BannZay

Description

@BannZay

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

Warning is generated for each argument with mismatched type for ---@vararg type and '---@param ... type' annotations.

Actual Behaviour

Warning generated only for the first passed argument.

Reproduction steps

  1. Paste following lua code into VSCode
---@param ... number
function Test(...) end
Test(1) -- OK, no warning
Test("1") -- OK, warning in place
Test(1, 2, 3) -- OK, no warnings
Test("1", "2", "3") -- There is only warning for "1" but no warning for "2" and "3". I.e. warning is only generated for the first argument
Test(1, "2", "3") -- still no warnings for "2" and "3".

Additional Notes

I am observing the same behavior for legacy ---@varargs

Image

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions