Skip to content

---@generic annotation doesn't restrict types #1663

@SalavatR

Description

@SalavatR

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?

Diagnostics/Syntax Checking

Expected Behaviour

---@Generic T:vector3|vector4 this annotation restrict types

Actual Behaviour

---@Generic T:vector3|vector4 this annotation does not restrict types, or i misunderstand something

Reproduction steps

---@Generic T:vector3|vector4
---@param v1 T first vector
---@param v2 T second vector
---@return T
function vmath.mul_per_elem(v1, v2) end

vmath.mul_per_elem("asd1", "asd") -- warning of wrong type using expected

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeat/LuaCats AnnotationsRelated to Lua Language Server Annotations (LuaCats)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions