Skip to content

Commit f0a8dd8

Browse files
authored
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.
1 parent 68ba7b6 commit f0a8dd8

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
@@ -3545,7 +3545,7 @@ function merge_override_effects!(interp::AbstractInterpreter, effects::Effects,
35453545
# N.B.: We'd like deleted_world here, but we can't add an appropriate edge at this point.
35463546
# However, in order to reach here in the first place, ordinary method lookup would have
35473547
# had to add an edge and appropriate invalidation trigger.
3548-
valid_worlds = WorldRange(m.primary_world, typemax(Int))
3548+
valid_worlds = WorldRange(m.primary_world, typemax(UInt))
35493549
if sv.world.this in valid_worlds
35503550
update_valid_age!(sv, valid_worlds)
35513551
else

Compiler/src/typeinfer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function adjust_effects(ipo_effects::Effects, def::Method, world::UInt)
475475
valid_worlds = WorldRange(0, typemax(UInt))
476476
if is_effect_overridden(override, :consistent)
477477
# See note on `typemax(Int)` instead of `deleted_world` in adjust_effects!
478-
override_valid_worlds = WorldRange(def.primary_world, typemax(Int))
478+
override_valid_worlds = WorldRange(def.primary_world, typemax(UInt))
479479
if world in override_valid_worlds
480480
ipo_effects = Effects(ipo_effects; consistent=ALWAYS_TRUE)
481481
valid_worlds = override_valid_worlds

0 commit comments

Comments
 (0)