LuaLS / LuaLS/lua-language-server
Incorrect type on string-key fields when combined with `[string]`
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Lua
- Estrelas
- 4.4k
- Forks
- 442
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
### 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_
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Nenhum arquivo do repositório ou teste é nomeado. Comece reproduzindo a busca anotada de GlobalModSettings no Lua language server por meio da Visual Studio Code extension e, em seguida, rastreie a resolução de tipos de campos indexados. Está concluído quando um campo com uma chave de string exata recebe seu tipo mais específico em vez do tipo de campo mais amplo [string].
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- lua
- Domínio
- devtools
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 38/100