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

Basic partial class support #3024

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tomlau10
Copy link
Contributor

@tomlau10 tomlau10 commented Jan 3, 2025

resolves #3023, resolves #2561


Since #2970, the partial class "hack" for not checking missing inherited fields no longer works.
This PR brings back this feature by introducing a partial attribute for @class.
A class marked with partial will not check missing inherited fields, just like the original checking behavior.

Example

---@class Config
---@field a number

---@class (partial) Config.P: Config
---@field b number

---@type Config.P[]
local cfgs = {}
cfgs[1] = { b = 1 } -- no warning
cfgs[2] = {}        -- only warns missing `b`

中文版

#2970 起,原有的 partial class hack 被封了。
這個 PR 對 @class 簡單地引入 partial 屬性
=> 帶 partial 屬性的 class 在檢查 missing fields 時會忽略 inherited class 的字段,就像之前的 check logic 一樣

a class marked with partial will not check missing inherited fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

关于诊断缺少继承的字段 [Future Ruquest] An easy way to create a partial of a class
1 participant