Skip to content

Commit 34e68cd

Browse files
KenoKristofferC
authored andcommitted
Fix signedness typo in world range update (#58390)
This manifested itself as a missing invalidation downstream, but I don't know if this is visible from Base. In general, we don't set the InferenceState's max_world to `typemax(UInt)`, but rather to the maximum world age at start of inference, and then we check at the end of inference if the world age is still the same, and only then raise it to `typemax(UInt)` (which arms the backedges). The downstream setup is a bit more complex, and I don't entirely know where this leaked out, but this change fixed it regardless. (cherry picked from commit f0a8dd8)
1 parent dbdfa11 commit 34e68cd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Compiler/src/abstractinterpretation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3497,7 +3497,7 @@ function merge_override_effects!(interp::AbstractInterpreter, effects::Effects,
34973497
# N.B.: We'd like deleted_world here, but we can't add an appropriate edge at this point.
34983498
# However, in order to reach here in the first place, ordinary method lookup would have
34993499
# had to add an edge and appropriate invalidation trigger.
3500-
valid_worlds = WorldRange(m.primary_world, typemax(Int))
3500+
valid_worlds = WorldRange(m.primary_world, typemax(UInt))
35013501
if sv.world.this in valid_worlds
35023502
update_valid_age!(sv, valid_worlds)
35033503
else

Compiler/src/typeinfer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ function adjust_effects(ipo_effects::Effects, def::Method, world::UInt)
362362
valid_worlds = WorldRange(0, typemax(UInt))
363363
if is_effect_overridden(override, :consistent)
364364
# See note on `typemax(Int)` instead of `deleted_world` in adjust_effects!
365-
override_valid_worlds = WorldRange(def.primary_world, typemax(Int))
365+
override_valid_worlds = WorldRange(def.primary_world, typemax(UInt))
366366
if world in override_valid_worlds
367367
ipo_effects = Effects(ipo_effects; consistent=ALWAYS_TRUE)
368368
valid_worlds = override_valid_worlds

0 commit comments

Comments
 (0)