Skip to content

Commit 7200046

Browse files
committed
Adjust to upcoming world age change in Julia 1.12
Julia 1.12 will change where world age increments are being inserted implicitly. The expansion of `@constinferred` is relying on an implicit world age increment between `eval` and the subsequent evaluation, which may go away in 1.12. Add an explicit marker to force the increment to be retained here. This preserves existing behavior. It may be the case that an alternative world age mechanism (e.g. invokelatest) is more appropriate, but it's hard for me to evaluate without full context.
1 parent dd88a53 commit 7200046

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/constinferred.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ testing type stability of a new function, where all arguments or keyword argumen
4141
the original function `f` that have a constant value (in the call expression) of type
4242
`Union{Number,Char,Symbol}` are hard coded.
4343
44-
If you want to test for constant propagation in a variable which is not hard-coded in
44+
If you want to test for constant propagation in a variable which is not hard-coded in
4545
the call expression, you can interpolate it into the expression.
4646
4747
Secondly, @constinferred returns the value if type inference succeeds, like `@inferred`,
@@ -175,9 +175,11 @@ function _constinferred(ex, mod, src, test_f, allow=:(Union{}))
175175
end
176176
$result
177177
end
178+
latestworld = isdefined(Core, :var"@latestworld") ? :(@Core.latestworld) : nothing
178179
finalex = Base.remove_linenums!(quote
179180
$pre
180181
Core.eval($mod, $fundefex)
182+
$latestworld
181183
let
182184
$main
183185
$post

0 commit comments

Comments
 (0)