`@overload` does not cooperate with `@class` when adding overloads to an inherited class method
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia con il comportamento delle annotazioni e del completamento Lua mostrato nella riproduzione, concentrandoti su come vengono gestite l’ereditarietà di @class e le dichiarazioni @overload. Riproduci il caso in NeoVim e verifica che il completamento e l’hover mostrino sia l’overload "bar" ereditato sia l’overload "baz" del figlio, senza una mancata corrispondenza del tipo del parametro.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
How are you using the lua-language-server?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Completion
Expected Behaviour
Adding an overload to a function inherited from another class should result in both the parent class' overloads and the new overload being suggested as autocomplete and hover tooltip entries.
Actual Behaviour
Adding an overload to a function inherited from another class makes that overload the only one that is recognized for the current class.
Reproduction steps
---@meta
---@class ParentClass
ParentClass = {}
---@param arg string
---@return unknown
---@overload fun(self, arg: "bar"): boolean
function ParentClass:foo(arg) end
---@class ChildClass : ParentClass
---@field foo fun(self, arg: "baz"): number
ChildClass = {}
ChildClass:foo(--[[Should suggest both "bar" and "baz", but only suggests "baz" and "bar" raises a param-type-mismatch]])
Redefining the function and adding an @overload there yields the same result.
Additional Notes
Having some way to mark a function redefinition as an overload (with strict checking that it does exist in the class defined as inherited from) would probably help solve this issue.
Log File
No response
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Merge medio
- 8g 9h
- PR unite (30g)
- 1
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di LuaLS/lua-language-server
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
LuaLS/lua-language-server#3463 · 5 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
LuaLS/lua-language-server#3461 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
LuaLS/lua-language-server#3460 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
LuaLS/lua-language-server#3459 · 1 reazione ·
Tutte le issue di LuaLS/lua-language-server
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
LandSandBoat/server#11579 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ArchiveTeam/sinavideo-grab#7 · 3 reazioni ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mailcow/mailcow-dockerized#7480 ·
-
mapper bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
documentation feature-request mini.completion
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100