Skip to content

Commit f3cbeef

Browse files
committed
typeinfer: Work around inference bug
See #58143 for details.
1 parent 96e9942 commit f3cbeef

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
@@ -1499,14 +1499,12 @@ function typeinf_ext_toplevel(methods::Vector{Any}, worlds::Vector{UInt}, trim_m
14991499
codeinfos = []
15001500
is_latest_world = true # whether this_world == world_counter()
15011501
workqueue = CompilationQueue(; interp = nothing)
1502-
for (i, this_world) in enumerate(sort!(worlds))
1502+
for this_world in reverse!(sort!(worlds))
15031503
workqueue = CompilationQueue(workqueue;
15041504
interp = NativeInterpreter(this_world; inf_params)
15051505
)
15061506

15071507
append!(workqueue, methods)
1508-
1509-
is_latest_world = (i == length(worlds))
15101508
if is_latest_world
15111509
# Provide the `invokelatest` queue so that we trigger "best-effort" code generation
15121510
# for, e.g., finalizers and cfunction.
@@ -1517,6 +1515,7 @@ function typeinf_ext_toplevel(methods::Vector{Any}, worlds::Vector{UInt}, trim_m
15171515
else
15181516
compile!(codeinfos, workqueue)
15191517
end
1518+
is_latest_world = false
15201519
end
15211520

15221521
if trim_mode != TRIM_NO && trim_mode != TRIM_UNSAFE

0 commit comments

Comments
 (0)