Skip to content

C library members typed as any - #3487

Open
jonathandw743 wants to merge 1 commit into
LuaLS:masterfrom
jonathandw743:lib_member_any
Open

jonathandw743 wants to merge 1 commit into
LuaLS:masterfrom
jonathandw743:lib_member_any

Conversation

@jonathandw743

Copy link
Copy Markdown

C library members are not always functions, they may be global variables.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文:该改动将 ffi.namespace 的索引字段类型从 function 放宽为 any,这与 LuaJIT FFI 的实际语义一致:ffi.C 命名空间下既可访问函数(如 ffi.C.printf),也可访问变量/常量(如 ffi.C.errno、ffi.C.EAGAIN),因此原类型标注不准确,此修改是合理的修正。未发现 bug、安全或回归问题。建议确认下游是否有依赖旧类型 function 做类型检查或代码生成的工具,若有需同步更新。

English: This change relaxes the indexed field type of ffi.namespace from function to any, which matches LuaJIT FFI's actual semantics: the ffi.C namespace exposes both functions (e.g. ffi.C.printf) and variables/constants (e.g. ffi.C.errno, ffi.C.EAGAIN), so the previous annotation was inaccurate and this fix is reasonable. No bugs, security issues, or regressions found. Recommend verifying whether any downstream tooling relies on the old function type for type checking or code generation, and update it if so.

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.

1 participant