Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic derivation function param type #2481

Merged
merged 3 commits into from Jan 17, 2024

Conversation

fesily
Copy link
Contributor

@fesily fesily commented Jan 16, 2024

#2479
Deriving local functions only
Never derive cross-file calls

script/vm/compiler.lua Outdated Show resolved Hide resolved
@sumneko sumneko merged commit 34319c7 into LuaLS:master Jan 17, 2024
7 checks passed
@fesily fesily deleted the automatic-derivation-function-param-type branch January 18, 2024 01:34
sumneko added a commit that referenced this pull request Jan 24, 2024
…ction-param-type"

This reverts commit 34319c7, reversing
changes made to ef7157c.
@sumneko
Copy link
Collaborator

sumneko commented Jan 24, 2024

此PR合并后项目产生了很多警告。
主要是2个问题:

  1. 没有考虑一个函数被多次调用的情况,导致无法推测联合类型
  2. 函数本来支持更加宽泛的类型,但是由于调用处使用了一个具体的类型,导致出现警告
local function f1(a) -- 这里被推测为 intger
end

f1(1)
f1(true)

local function f2(anyTable) -- 这里被推测为 iolib
    if anyTable.xxx then -- 警告:iolib 不存在字段 xxx
    end
end

f2(io)

因此我先将此PR撤销了。

另外其他PR也引入了一些警告,以后提PR时需要注意把项目的警告清0。

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.

None yet

2 participants