LuaLS / LuaLS/lua-language-server
assign-type-mismatch not reported for global values
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?
NeoVim
### Which OS are you using?
Linux
### What is the issue affecting?
Annotations, Type Checking, Diagnostics/Syntax Checking
### Expected Behaviour
With a global table that has type-annotated fields, reassigning a field to an incorrectly-typed value should report `[assign-type-mismatch]`
### Actual Behaviour
No diagnostic is reported, even though autocompletion indicates that the type is understood by the server. Further, assigning a local variable to the global value and doing the same thing _does_ report the diagnostic correctly.
### Reproduction steps
```lua
---@class test
_G.test = {
---@type boolean
foo = true,
}
test.foo = 'bar' -- no error
_G.test.foo = 'bar' -- no error
local test2 = test
test2.foo = 'bar' -- [assign-type-mismatch]
```
### Additional Notes
_No response_
### 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
Führe zunächst die mitgelieferte Lua-Reproduktion aus und vergleiche die Diagnosen für test.foo, _G.test.foo und test2.foo. Verfolge den Pfad der Typprüfung und Diagnoseerzeugung für globale Werte; fertig ist es, wenn die beiden globalen Zuweisungen konsistent mit dem Fall des lokalen Alias [assign-type-mismatch] melden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100