LuaLS / LuaLS/lua-language-server
lua-language-server not detecting types when destructuring Tuple types with ~table.unpack~
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
How are you using the lua-language-server?
Other
Which OS are you using?
Windows
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
I might be wrong here, but I assume this should work?
Language server should detect the types from the defined tuple:
---@alias my_tuple { [1]: integer, [2]: boolean }
---@type my_tuple
local tuple = {1, true}
--- This works!
local a, b = tuple[1], tuple[2]
--- This gets "integer" for "c", but "unknown" for "d:
local c, d = table.unpack(tuple)
Actual Behaviour
---@alias my_tuple { [1]: integer, [2]: boolean }
---@type my_tuple
local tuple = {1, true}
--- "c" should be "integer" and "d" "boolean":
local c, d = table.unpack(tuple)
Reproduction steps
- Define tuple like I did
- Create such tuple
unpackto two variables
Additional Notes
I'm not sure if this is a feature that is even considered, but since I do use unpack sometimes to destructure tuples into their distinct variables, I feel this would be a good feature to have.
Log File
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Problem mit dem tuple- und table.unpack-Beispiel aus dem Bericht zu reproduzieren, und verfolge dann die Typinferenz des language server für multiple assignment und unpacked tables. Es werden keine Quelldateien oder Tests genannt; als erledigt gilt die Aufgabe, wenn das Beispiel c als integer und d als boolean inferiert, ohne bestehende tuple-Diagnosen zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100