Skip to content

Override is prevented from linter #3039

@jakitliang

Description

@jakitliang

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

local a = {}
a.__index = a
function a:m1()
end

-- b inherit from a
local b = setmetatable({}, a)
-- override m2()
function b:m2() --- no warning generated
end

Actual Behaviour

local a = {}
a.__index = a
function a:m1()
end

-- b inherit from a
local b = setmetatable({}, a)
-- override m2()
function b:m2() --- duplicate field `m`
end

image

Reproduction steps

  1. Just copy the code and lint them

Additional Notes

Inheritance and override methods is prevent by LuaLS linter.

Override is a common and basic concept. But LuaLS seems can't recognize it but provide warnings.

In the case, m2 is not a duplicate field, but just shadowing or overriding.

Log File

No response

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