Skip to content

Improve error message when extension file does not contain module #51626

@jakobnissen

Description

@jakobnissen

I just tried to create a package extension, but forgot to wrap the code in the extension file in its own module. I got an error saying:

[ Info: Precompiling TestExt [29286dec-c893-52d1-88fe-e07e79eb4405]
ERROR: LoadError: ArgumentError: Package Base does not have Test in its dependencies:
- You may have a partially installed environment. Try `Pkg.instantiate()`
  to ensure all packages in the environment are installed.
- Or, if you have Base checked out for development and have
  added Test as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with Base
Stacktrace:
 [1] macro expansion
   @ Base ./loading.jl:1770 [inlined]
 [2] macro expansion
   @ Base ./lock.jl:267 [inlined]
 [3] __require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1747

IMO this error is pretty confusing because it claimed I was trying to load Test from Base, whereas in fact, I tried loading it in my extension module.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions