You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---@class (exact) TypeA---@fieldtype'A'---@fieldcommonFieldnumber---@fieldspecificFieldAnumber---@class (exact) TypeB---@fieldtype'B'---@fieldcommonFieldstring---@fieldspecificFieldBstring---@aliasType_Either_A_Or_B_But_Not_BothTypeA|TypeB---@typeType_Either_A_Or_B_But_Not_BothlocaltestA= {
type='A', --- Indicates that this should be of TypeAcommonField='test', --- Should be an error. TypeA.commonField should be a numberspecificFieldA=123, --- OKspecificFieldB='Hello' --- Should be an error. TypeA.specificFieldB doesn't exist
}
---@typeType_Either_A_Or_B_But_Not_BothlocaltestB= {
type='B', --- Indicates that this should be of TypeBcommonField='test', --- OKspecificFieldA=123, --- Should be an error. TypeB.specificFieldA doesn't existspecificFieldB='Hello' --- OK
}
Actual Behaviour
TypeA|TypeB is merged, so none of the mismatched fields/types are reported as errors.
and when you complete for fields with shape., you get width, height, radius, and kind, even though it picks up that shape.height is undefined in that block.
ifshape.kind=="circle" thenshape.height-- Lua Diagnostics.: Undefined field `height`. [undefined-field]end
I would expect that both completion options and the resolved type get narrowed inside of the if block.
Activity
AlexanderHott commentedon May 30, 2026
+1
On
3.18.2I get the same behavior.If you hover
shapein the"circle"if block, you getand when you complete for fields with
shape., you getwidth,height,radius, andkind, even though it picks up thatshape.heightis undefined in that block.I would expect that both completion options and the resolved type get narrowed inside of the
ifblock.