-
-
Notifications
You must be signed in to change notification settings - Fork 372
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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
I expect the following example to work without any issues (it worked in the past):
---@class A
local A = {}
---@class B : A
local B = {}
---@class C : B
local C = {}
---@class D : B
local D = {}
---@overload fun(self : A, s : string)
function A:func() end
---@type D|C
local var
var:func('hi')
There should be no errors when calling the function overload var:func('hi')
Actual Behaviour
Cannot assign `C|D` to parameter `A`.
- `C` cannot match `A`
- Type `C` cannot match `A`
- Type `B` cannot match `A`
Reproduction steps
Try the example above with the latest VS Code extension
Additional Notes
From my testing, it only seems to happen when all of the following features are combined:
- Indirect inheritance (
C
is a child ofB
which is a child ofA
) - Using a union type of two or more classes that indirectly inherit from a type (
C|D
) - Calling an overloaded version of a method (
@overload fun(self : A, s : string)
)
Log File
No response
C3pa
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working