Closed
Description
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Annotations, Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
Should be a type error to not include all required fields from both parent and child class.
Actual Behaviour
Only fields from the child class are required.
With an empty table, we get a warning about missing the fields from the child class:
When we fill in those fields, we get no warnings, even though the fields from the parent class are still missing:
If we explicitly assign nil
, we do get warnings:
Reproduction steps
Check the diagnostics for the following snippets:
---@class Parent
---@field a string
---@field b string
---@class Child : Parent
---@field c string
---@field d string
---@type Child
local my_child = {} -- We get a warning here saying `c` and `d` are missing
---@class Parent
---@field a string
---@field b string
---@class Child : Parent
---@field c string
---@field d string
---@type Child
local my_child = {
c = 'c',
d = 'd',
} -- but no diagnostics here, even though `a` and `b` are missing
Additional Notes
No response
Log File
No response
Metadata
Metadata
Assignees
Labels
No labels