LuaLS / LuaLS/lua-language-server

Multipe parameters infer differently?

未關閉
#1,343 1 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

enhancement
主要語言
Lua
星號
4.4k
分支
442
PR 合併指標
30 天內沒有已合併 PR

描述

Infers `a` and `aa` correctly but not the rest
```lua
---@diagnostic disable: codestyle-check, spell-check, unused-local

---@alias AnyChild A|B|C
---@class PARENT
local PARENT = {}
---@class A: PARENT
local A = {}
---@class B: PARENT
local B = {}
---@class C: PARENT
local C = {}

---@overload fun(self:PARENT): A
---@overload fun(self:AnyChild, other: A): A
---@overload fun(self:AnyChild, other: B): B
function PARENT:new(other)
self.a = 2
return {}
end

local a = A:new()
local aa = a:new()

local aaa = a:new(B)
local b = B:new(B)
local bb = b:new(B)
local bbb = b:new(C)
```
![image](https://user-images.githubusercontent.com/13972192/179435469-d37ee591-8d0a-4b13-a818-4562b05dccfe.png)

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從嵌入式 Lua 重現開始,檢查 language server 為 `aaa`、`b`、`bb` 和 `bbb` 推斷的型別,並與 `a` 和 `aa` 進行比較。追蹤冒號呼叫和多個參數的多載解析,然後新增或執行一個有針對性的回歸測試,確認所有範例的預期推斷型別。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
lua
領域
tooling
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。