Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect function definition location for mismatched_arg_count lint #259

Closed
matthargett opened this issue Jun 16, 2021 · 0 comments · Fixed by #274
Closed

incorrect function definition location for mismatched_arg_count lint #259

matthargett opened this issue Jun 16, 2021 · 0 comments · Fixed by #274
Labels
A-lints Area: Relating to a lint directly C-bug Category: Bug

Comments

@matthargett
Copy link
Contributor

this code (heavily reduced from much larger real code):

return function()
        describe("", function()
                it("", function()
                        local _dispatch

                        local function SomeComponent(props)
                                _dispatch = function()
                                end
                        end

                        _dispatch("foo")
                end)
        end)
end

gets this output:

error[mismatched_arg_count]: this function takes 0 arguments but 1 arguments were supplied
   ┌─ /Users/mhargett/src/t8.lua:4:10
   │
 4 │             local _dispatch
   │                   --------- note: function defined here
   ·
11 │             _dispatch("foo")
   │             ^^^^^^^^^^^^^^^^ expected 0 arguments

The lint is correct, and adding a parameter to the function signature silences the warning, but it should be telling me where the function was assigned -- not where it was declared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Relating to a lint directly C-bug Category: Bug
Projects
None yet
2 participants