LuaLS / LuaLS/lua-language-server
Generics, inheritance and an overloaded constructor
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Lua
- Star
- 4.4k
- Fork
- 442
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
VisualStudio Code on Windows, lua-language-server v3.7.4 (Last updated 2024-01-07, 10:29:54)
The following error occurs only when a generic inherits from a type containing an overloaded constructor.
local e = Entity()
e:get(Transform2)
e:get(Transform)
The only difference between Transform and Transform2 is the overloaded constructor.
I could "workaround" this issue by removing : ComponentBase from the function Entity:get ... but I want to check whether the given component type is valid.
Here is the simplified annotation file:
---@class ComponentBase
---@class Transform: ComponentBase
Transform = {}
---@class Transform2: ComponentBase
---@overload fun(x: number, y: number): Transform2
Transform2 = {}
---@class Entity
---@overload fun(): Entity
Entity = {}
---@generic T: ComponentBase
---@param type T
---@return T
function Entity:get(type) end
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với tệp chú thích đơn giản hóa trong issue và tái hiện chẩn đoán trong Visual Studio Code trên Windows bằng lua-language-server v3.7.4. So sánh các lệnh gọi Entity:get tổng quát cho Transform và Transform2, sau đó xác minh rằng các kiểu thành phần hợp lệ được xử lý nhất quán mà không có lỗi được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- lua
- Lĩnh vực
- devtools
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100