LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.26k stars 306 forks source link

Advanced missing nil check #1214

Open FlashHit opened 2 years ago

FlashHit commented 2 years ago

This is probably really hard to "fix".

---@type table|nil
local blueprint = { x = 1 }
local hasBlueprint = true

if blueprint == nil then
    hasBlueprint = false
end

if hasBlueprint then
    error("no blueprint found")
end

local s = blueprint.x

grafik

sumneko commented 2 years ago

I don't know how to implement this feature

jlaurens commented 2 months ago

This is highly difficult because error could have been intentional redefined locally not to raise an error.