Skip to content

"world prior to its definition" warning when modifying struct #925

@tpapp

Description

@tpapp

I was working on some code in Julia 1.12.0-beta3, using Revise 3.8.0. Specifically on a section

struct Shift{T <: AbstractVector}
    irrelevant_field::Int # for the MWE
    b::T
end

shift(b::AbstractVector) = Shift(b)

within a package.

I modified the type Shift deleting irrelevant_field and after evaluating something in the REPL, I got

WARNING: Detected access to binding `LogDensityTestSuite.shift` in a world prior to its definition world.
  Julia 1.12 has introduced more strict world age semantics for global bindings.
  !!! This code may malfunction under Revise.
  !!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
To make this warning an error, and hence obtain a stack trace, use `julia --depwarn=error`.

But everything seems to work fine, shift has the right methods, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions