Skip to content

bug on LTS with const global of mutable struct type #58264

@nsajko

Description

@nsajko

Bug on Julia v1.10.

Say this is a package (must be precompiled to reproduce):

module ExamplePackage
mutable struct WKTGrammarSymbolKind
  const global kinds = Set{WKTGrammarSymbolKind}()
  function WKTGrammarSymbolKind()
    kind = new()
    push!(kinds, kind)
    kind
  end
end
const x = WKTGrammarSymbolKind()
end

MWE:

julia> using ExamplePackage
 
julia> ExamplePackage.x in ExamplePackage.kinds  # BUG!
false
 
julia> objectid(ExamplePackage.x) === objectid(only(ExamplePackage.kinds))  # OK
true

Version info:

Julia Version 1.10.9
Commit 5595d20a287 (2025-03-10 12:51 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 4
  JULIA_PKG_PRECOMPILE_AUTO = 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:precompilationPrecompilation of modulespackagesPackage management and loading

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions