Skip to content

Commit d54649f

Browse files
committed
typeinfer: Work around inference bug
See #58143 for details.
1 parent ce56baa commit d54649f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Compiler/src/typeinfer.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,14 +1618,12 @@ function typeinf_ext_toplevel(methods::Vector{Any}, worlds::Vector{UInt}, trim_m
16181618
codeinfos = []
16191619
is_latest_world = true # whether this_world == world_counter()
16201620
workqueue = CompilationQueue(; interp = nothing)
1621-
for (i, this_world) in enumerate(sort!(worlds))
1621+
for this_world in reverse!(sort!(worlds))
16221622
workqueue = CompilationQueue(workqueue;
16231623
interp = NativeInterpreter(this_world; inf_params)
16241624
)
16251625

16261626
append!(workqueue, methods)
1627-
1628-
is_latest_world = (i == length(worlds))
16291627
if is_latest_world
16301628
# Provide the `invokelatest` queue so that we trigger "best-effort" code generation
16311629
# for, e.g., finalizers and cfunction.
@@ -1636,6 +1634,7 @@ function typeinf_ext_toplevel(methods::Vector{Any}, worlds::Vector{UInt}, trim_m
16361634
else
16371635
compile!(codeinfos, workqueue)
16381636
end
1637+
is_latest_world = false
16391638
end
16401639

16411640
if trim_mode != TRIM_NO && trim_mode != TRIM_UNSAFE

0 commit comments

Comments
 (0)