Generated functions and world age

The following used to work, but doesn’t anymore:

julia> @generated f()=g()
f (generic function with 1 method)

julia> g() = 2
g (generic function with 1 method)

julia> f()
ERROR: MethodError: no method matching g()
The applicable method may be too new: running in world age 21269, while current world is 21270.
Closest candidates are:
  g() at REPL[2]:1 (method too new to be called from this world context.)
Stacktrace:
 [1] f(...) at ./REPL[1]:1

Is this a bug or a known limitation?
The above happens a lot in the Interpolations package, which relies on generated functions in many places.

This is a known feature. https://github.com/JuliaLang/julia/issues/19942

1 Like