Skip to content

includet gives error when include doesn't #753

@sadish-d

Description

@sadish-d

I have a .jl file where I define struct S that I call from another .jl file with using Revise; includet("path_to_file").

With this definition of S, I get ERROR: invalid redefinition of type S even when I'm in a completely new Julia session.

struct S{N}
    x::Array{<:Real, N}

    S{N}(x::Array{<:Real, N}) where N = new{N}(x)
    S(x::Array{<:Real, N}) where N = S{N}(x) # remove this and the error goes away
end

If I remove the second constructor, the error goes away.

I do not get the error, with or without the second constructor, if I use include instead of includet.

julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 

another user was able to replicate the error: discourse discussion

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