LuaLS / LuaLS/lua-language-server
Annotation type any not working properly
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking
Expected Behaviour
Variant 1:
Type 'any' allows any type except 'nil'. Type nil it's nil, not any.
@param cc any|nil should allow to use nil type
Variant 2:
When checking a type, you need to always have an argument, no matter what type. The argument must be specified in the method call. Сalling with an empty argument is not allowed
Variant 3: a special flag in param annotation that indicates an argument must be specified here
Actual Behaviour
---@param cc any
local function Test(cc)
print(cc)
end
Test() -- no error
Type any allow nil type.
For example:
LUA + luabind C++.
C++ required argument on all bindings. Test(nil) and Test() have different behaviour for luabind.
Reproduction steps
- Go to '...'
- Click '...'
- See error '...'
Additional Notes
No response
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 Visual Studio Code 扩展中复现报告的注解示例:比较 @param cc any 和 @param cc any|nil 下的 Test() 与 Test(nil)。该 issue 提出了几种可能的语义,但没有指明源文件或测试;首先确定预期的规则,然后验证完成后的行为能够区分省略的参数和显式的 nil。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua, vscode
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100