Skip to content

Overload bug expecting more params #633

@NyakoFox

Description

@NyakoFox

I have a LOVE function annotated as so:

--- Draws a rectangle.
---@param mode DrawMode # How to draw the rectangle.
---@param x number # The position of top-left corner along the x-axis.
---@param y number # The position of top-left corner along the y-axis.
---@param width number # Width of the rectangle.
---@param height number # Height of the rectangle.
---@overload fun(mode:DrawMode, x:number, y:number, width:number, height:number, rx:number, ry:number?, segments:number?):void
function love.graphics.rectangle(mode, x, y, width, height) end

Which takes in 5 arguments by default.

I'm doing this: love.graphics.rectangle("line", self:getBoundingBox()), where getBoundingBox() returns 4 arguments. So this works in code.

And VSCode displays the proper 5-argument function:

Image

However, there is also a warning:

Image

where it talks about the 8-argument overload rather than the 5-argument one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions