-
-
Notifications
You must be signed in to change notification settings - Fork 420
Function overloading by declaring multiple functions with same name appears to be completely broken #3396
Copy link
Copy link
Open
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels