EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.73k stars 290 forks source link

[bug]代码注解,pairs提示类型不匹配 #460

Open hymanlv opened 2 years ago

hymanlv commented 2 years ago

Environment(环境)

Rider 2020.3.3
Rider version Build #RD-203.7148.23, built on February 17, 2021
EmmyLua version 1.3.5.194-IDEA203
OS Windows 10 专业版, 21H1, 19043.1526

What are the steps to reproduce this issue?(重现步骤?)

  1. 开启代码检查:File->Settings->Editor->Inspection Settings->Inspection Severity->Other language->"Lua>Lint>Type safety"
  2. Match function signature 选项打钩
  3. 编辑lua代码 function test() ---@type number[] local ns = {} ns[#ns +1] = 1 ns[#ns +1] = 2 ns[#ns +1] = 3 for _, n in pairs(ns) do n = n end end

What happens?(出现什么问题?)

pairs(ns)处提示: Type mismatch. Required: 'table<K, V>|V[]' Found: 'number[]' local variable "ns"

What were you expecting to happen?(期望?)

如果pairs参数是字典or数组 没有错误提示 如果pairs参数是其他类型 有错误提示

Any logs, error output, etc?(有没有什么log, error输出?)

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Any other comments?(其它说明)