LuaLS / LuaLS/lua-language-server
Incorrect type on string-key fields when combined with `[string]`
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Lua
- Estrellas
- 4.4k
- Forks
- 442
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
### Which OS are you using?
Windows
### What is the issue affecting?
Type Checking
### Expected Behaviour
we have a (generated) class like
```
---@class GlobalModSettings
---@field ["heat-visualizer-updates-per-surface-per-tick"] ModSetting
---@field ["nixie-tube-update-speed-alpha"] ModSetting
---@field ["nixie-tube-update-speed-numeric"] ModSetting
---@field [string] ModSetting<(int32)|(double)|(boolean)|(string)|(Color)>
```
which has narrower types for the known entries and a general type for the "everything else" field, but when i then use this type like
```
local x = settings.global["heat-visualizer-updates-per-surface-per-tick"]
```
`x` is given the type from the `[string]` field, rather than the one that is an exact match for that specific string
### Actual Behaviour
(this template is always off screen and i've written the whole thing in the first box...)
### Reproduction steps
(this template is always off screen and i've written the whole thing in the first box...)
### Additional Notes
_No response_
### Log File
_No response_
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
No se nombra ningún archivo del repositorio ni ninguna prueba. Empieza reproduciendo la búsqueda anotada de GlobalModSettings en el Lua language server mediante la Visual Studio Code extension y, después, sigue la resolución de tipos de los campos indexados. Se considera terminado cuando un campo con una clave de cadena exacta recibe su tipo más específico en lugar del tipo de campo más amplio [string].
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- lua
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100