@@ -148,10 +148,23 @@ return function(META--[[#: any]])
148148 end
149149
150150 do
151- function META :TrackDependentUpvalues (obj )
151+ function META :TrackDependentUpvalues (obj , follow_intermediate )
152152 local upvalue = obj :GetUpvalue ()
153153
154- if not upvalue then return end
154+ if not upvalue then
155+ -- Follow LeftRightSource chains only when traversing from a
156+ -- stored variable's chain (not from direct condition expressions)
157+ if follow_intermediate and obj .Type == " union" then
158+ local left_right = obj :GetLeftRightSource ()
159+
160+ if left_right then
161+ self :TrackDependentUpvalues (left_right .left , true )
162+ self :TrackDependentUpvalues (left_right .right , true )
163+ end
164+ end
165+
166+ return
167+ end
155168
156169 local val = upvalue :GetValue ()
157170 local truthy_falsy = upvalue :GetTruthyFalsyUnion ()
@@ -164,8 +177,8 @@ return function(META--[[#: any]])
164177 local left_right = val :GetLeftRightSource ()
165178
166179 if left_right then
167- self :TrackDependentUpvalues (left_right .left )
168- self :TrackDependentUpvalues (left_right .right )
180+ self :TrackDependentUpvalues (left_right .left , true )
181+ self :TrackDependentUpvalues (left_right .right , true )
169182 end
170183 end
171184 end
@@ -472,6 +485,7 @@ return function(META--[[#: any]])
472485
473486 local function apply_mutation (self , data )
474487 local obj = collect_truthy_values (data .stack )
488+
475489 if not obj then return end
476490
477491 if data .kind == " upvalue" then
0 commit comments