Describe the bug
Undefined field diagnostic broken in some cases
To Reproduce
Open code in editor. If you uncomment ---@type annotation all works fine
I guess something wrong with types inference
---@class CEntityInstance
CEntityInstance = {}
---@class CBaseEntity:CEntityInstance
CBaseEntity = {}
---@class CBaseModelEntity:CBaseEntity
CBaseModelEntity = {}
---@class CBaseAnimating:CBaseModelEntity
CBaseAnimating = {}
---@class CBaseFlex:CBaseAnimating
CBaseFlex = {}
---@class CDOTA_BaseNPC:CBaseFlex
CDOTA_BaseNPC = {}
---@return string
function CDOTA_BaseNPC:GetUnitName() end
---@return number
function CDOTA_BaseNPC:GetHealth() end
---@return CDOTA_BaseNPC
function CreateTestUnit() end
-----@type CDOTA_BaseNPC
local unit = CreateTestUnit()
unit.testField = 3
if unit.testField then
local test = unit.testField
end
Screenshots

Environment
- OS: Windows 10
- Client: VSCode
Describe the bug
Undefined field diagnostic broken in some cases
To Reproduce
Open code in editor. If you uncomment ---@type annotation all works fine
I guess something wrong with types inference
Screenshots

Environment