Revision 63e365feb8692b9d7cb5298954c26ab7af268171 authored by Keno Fischer on 23 March 2024, 05:18:55 UTC, committed by GitHub on 23 March 2024, 05:18:55 UTC
Currently, in order to give the nice prompt for missing packages, we look for any `using`/`import` statements in the AST before evaluation. However, this misses any `using` statements introduced by macros: ``` julia> using Pkg julia> using BenchmarkTools │ Package BenchmarkTools not found, but a package named BenchmarkTools is │ available from a registry. │ Install package? │ (@v1.11) pkg> add BenchmarkTools └ (y/n/o) [y]: n ERROR: ArgumentError: Package BenchmarkTools not found in current path. - Run `import Pkg; Pkg.add("BenchmarkTools")` to install the BenchmarkTools package. Stacktrace: [1] macro expansion @ Base ./loading.jl:1781 [inlined] [2] macro expansion @ Base ./lock.jl:267 [inlined] [3] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1762 [4] #invoke_in_world#3 @ Base ./essentials.jl:963 [inlined] [5] invoke_in_world @ Base ./essentials.jl:960 [inlined] [6] require(into::Module, mod::Symbol) @ Base ./loading.jl:1755 julia> macro foo() :(using BenchmarkTools) end @foo (macro with 1 method) julia> @foo ERROR: ArgumentError: Package BenchmarkTools not found in current path. - Run `import Pkg; Pkg.add("BenchmarkTools")` to install the BenchmarkTools package. Stacktrace: [1] macro expansion @ Base ./loading.jl:1781 [inlined] [2] macro expansion @ Base ./lock.jl:267 [inlined] [3] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1762 [4] #invoke_in_world#3 @ Base ./essentials.jl:963 [inlined] [5] invoke_in_world @ Base ./essentials.jl:960 [inlined] [6] require(into::Module, mod::Symbol) @ Base ./loading.jl:1755 [7] top-level scope @ REPL[4]:1 ``` Generally, it doesn't matter, but embedded DSLs may want to do this kind of thing, so we might as well try to support it.
1 parent 6172020
File | Mode | Size |
---|---|---|
.devcontainer | ||
.github | ||
base | ||
cli | ||
contrib | ||
deps | ||
doc | ||
etc | ||
src | ||
stdlib | ||
test | ||
.buildkite-external-version | -rw-r--r-- | 5 bytes |
.clang-format | -rw-r--r-- | 3.3 KB |
.clangd | -rw-r--r-- | 114 bytes |
.codecov.yml | -rw-r--r-- | 52 bytes |
.git-blame-ignore-revs | -rw-r--r-- | 371 bytes |
.gitattributes | -rw-r--r-- | 65 bytes |
.gitignore | -rw-r--r-- | 571 bytes |
.mailmap | -rw-r--r-- | 12.7 KB |
CITATION.bib | -rw-r--r-- | 513 bytes |
CITATION.cff | -rw-r--r-- | 1012 bytes |
CONTRIBUTING.md | -rw-r--r-- | 23.4 KB |
HISTORY.md | -rw-r--r-- | 388.1 KB |
LICENSE.md | -rw-r--r-- | 1.3 KB |
Make.inc | -rw-r--r-- | 56.0 KB |
Makefile | -rw-r--r-- | 30.3 KB |
NEWS.md | -rw-r--r-- | 4.4 KB |
README.md | -rw-r--r-- | 7.4 KB |
THIRDPARTY.md | -rw-r--r-- | 3.9 KB |
VERSION | -rw-r--r-- | 11 bytes |
julia.spdx.json | -rw-r--r-- | 37.8 KB |
pkgimage.mk | -rw-r--r-- | 1.4 KB |
sysimage.mk | -rw-r--r-- | 4.2 KB |
typos.toml | -rw-r--r-- | 78 bytes |
Computing file changes ...