Repository navigation
Add field completion for generic table literals - #3506
NathanSnail wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
中文:发现以下可操作问题:
-
测试用例
NumberRange缺少泛型参数,可能导致测试本身无效
第一个测试中---@class NumberRange没有声明泛型参数<T>,但字段min T/max T引用了未声明的T。这可能在编译期被当作未知类型处理,从而无法真正验证"普通 table literal 注释补全"这一回归路径,或者产生误导性的通过。建议确认为什么这里不声明<T>,或者改成非泛型的具体类型(如min number)来明确第一个测试只是验证基础 table 注释补全,而非泛型逻辑。 -
未覆盖 array 类型和
doc.type.sign的补全测试
编译器改动同时允许了doc.type.table、doc.type.array和新增的doc.type.sign三种类型设置节点,但测试只覆盖了 table({}字面量)。建议补充 array 字面量(如---@type Range<number>配合{ ... }数组风格)以及可能触发doc.type.sign的场景,确保新增分支不会引入回归。 -
changelog 描述与实际改动范围不完全一致
changelog 只提到"instantiated generic type"的 table literal 补全修复,但代码改动同时影响了doc.type.array和doc.type.sign的节点设置行为。这是行为扩展而非纯修复,建议 changelog 措辞更准确地反映改动范围,或确认doc.type.sign分支的必要性并加以说明。
English: The following actionable issues were found:
-
The
NumberRangetest case lacks generic parameters, which may make the test ineffective
In the first test,---@class NumberRangedoes not declare a generic parameter<T>, yet fieldsmin T/max Treference an undeclaredT. This may be treated as an unknown type at compile time, meaning it cannot actually verify the regression path of "plain table literal annotation completion", or it may produce a misleading pass. Confirm why<T>is intentionally omitted here, or change it to concrete non-generic types (e.g.min number) to make clear that the first test only verifies basic table annotation completion rather than generic logic. -
No completion tests cover array types or
doc.type.sign
The compiler change allows node setting fordoc.type.table,doc.type.array, and the newly addeddoc.type.sign, but the tests only cover table ({}) literals. Add tests for array-style literals (e.g.---@type Range<number>with array-style{ ... }) and scenarios that could triggerdoc.type.sign, to ensure the new branch doesn't introduce regressions. -
Changelog description does not fully match the actual change scope
The changelog only mentions a fix for table literal completion with "instantiated generic type", but the code change also affects node-setting behavior fordoc.type.arrayanddoc.type.sign. This is a behavior extension rather than a pure fix; the changelog wording should more accurately reflect the change scope, or the necessity of thedoc.type.signbranch should be confirmed and documented.
No description provided.