Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JET chokes on "pkgdir()" #565

Open
tamasgal opened this issue Sep 12, 2023 · 1 comment
Open

JET chokes on "pkgdir()" #565

tamasgal opened this issue Sep 12, 2023 · 1 comment

Comments

@tamasgal
Copy link

I have the following dummy package as MWE:

$ tree
.
└── Foo
    ├── Project.toml
    └── src
        └── Foo.jl

2 directories, 2 files

$ cat Foo/Project.toml
name = "Foo"
uuid = "92be8fcb-e36f-4a7e-b4ff-aa3da158d331"
authors = ["Tamas Gal"]
version = "0.1.0"

$ cat Foo/src/Foo.jl
module Foo

joinpath(pkgdir(Foo), "bar")

end # module Foo

and when running report_package there is an error since in JET's scope, pkgdir() obviously returns nothing and then joindir fails due to the missing method:

julia> using JET

julia> report_package("Foo")
[toplevel-info] virtualized the context of Main (took 0.008 sec)
[toplevel-info] entered into /Users/tamasgal/tmp/jet/Foo/src/Foo.jl
[toplevel-info]  exited from /Users/tamasgal/tmp/jet/Foo/src/Foo.jl (took 1.614 sec)
═════ 1 toplevel error found ═════
┌ @ /Users/tamasgal/tmp/jet/Foo/src/Foo.jl:3
│ MethodError: no method matching joinpath(::Nothing, ::String)
│
│ Closest candidates are:
│   joinpath(::AbstractString...)
│    @ Base path.jl:327
└─────────────────────


julia>

A bit of a background story: one of my packages uses the following top-level line to get access to its own version which is needed for metadata in files the package generates:

const version = VersionNumber(Pkg.TOML.parsefile(joinpath(pkgdir(KM3io), "Project.toml"))["version"])

I am not able to evaluate anything further because JET stops at this line.

Side quest: I am open for any suggestions how to obtain the version number 😉

@fingolfin
Copy link

Regarding the version number, see also this discourse thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants