How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
MacOS
What is the issue affecting?
Annotations, Type Checking
Expected Behaviour
Given:
---@meta
---@param stringParam string
function DoSomething(stringParam) end
---@param intParam1 integer
---@param intParam2 integer
function DoSomething(intParam1, intParam2) end
DoSomething("test")
I would expect DoSomething("test") to pass typechecking, because it meets the first definition of DoSomething (a single string parameter).
Actual Behaviour
Typechecking fails with "This function requires 2 argument(s) but instead it is receiving 1. (missing-parameter)"
Reproduction steps
- Paste the above code into a file
- Hover over the last line (
DoSomething("test"))
- See error
Additional Notes
This issue does not apply to the use of @overload for functions. This passes typechecking:
---@meta
---@param stringParam string
---@overload fun(intParam1: integer, intParam2: integer)
function DoSomething(stringParam) end
DoSomething("test")
Log File
No response