You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
one can create a package to test this, the Project.toml looks like following
name = "PkgModule"uuid = "81468456-a077-41e9-90c9-0e047517ca6f"authors = ["Roger-Luo <rogerluo.rl18@gmail.com> and contributors"]
version = "0.1.0"
[deps]
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
[compat]
julia = "1.6.1"
[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[preferences.PkgModule.color]
name = "light_blue"
[targets]
test = ["Test"]
the src/PkgModule.jl looks like this
module PkgModule
using Preferences
# uncomment the following to reproduce error# const color = @load_preference("color")# const color = load_preference(PkgModule, "color")end
while I'm expecting color to be loaded as a Dict, but I'm getting
julia>using PkgModule
[ Info: Precompiling PkgModule [81468456-a077-41e9-90c9-0e047517ca6f]
fatal: error thrown and no exception handler available.
TypeError(func=:typeassert, context="", expected=Union{Nothing, String}, got=Base.Dict{String, Any}(slots=Array{UInt8, (16,)}[0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], keys=Array{String, (16,)}[
#<null>,"name",
#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>], vals=Array{Any, (16,)}[#<null>,"light_blue",
#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>,#<null>], ndel=0, count=1, age=0x0000000000000001, idxfloor=2, maxprobe=0))
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:119
jl_type_error at /buildworker/worker/package_linux64/build/src/rtutils.c:127
get_preferences_hash at ./loading.jl:1662
get_preferences_hash at ./loading.jl:1671
jfptr_get_preferences_hash_50003.clone_1 at /home/roger/.ion/packages/julia-1.6/julia-1.6.1/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
write_dependency_list at /buildworker/worker/package_linux64/build/src/dump.c:1150 [inlined]
jl_save_incremental at /buildworker/worker/package_linux64/build/src/dump.c:2139
jl_write_compiler_output at /buildworker/worker/package_linux64/build/src/precompile.c:65
jl_atexit_hook at /buildworker/worker/package_linux64/build/src/init.c:211
repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:703
main at /buildworker/worker/package_linux64/build/cli/loader_exe.c:51
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at /home/roger/.ion/packages/julia-1.6/julia-1.6.1/bin/julia (unknown line)
ERROR: Failed to precompile PkgModule [81468456-a077-41e9-90c9-0e047517ca6f] to /home/roger/.julia/compiled/v1.6/PkgModule/jl_84dbrq.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
@ Base ./loading.jl:1360
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1306
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1021
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:914
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:901
[7] eval
@ ./boot.jl:360 [inlined]
[8] eval
@ ./Base.jl:39 [inlined]
[9] repleval(m::Module, code::Expr, #unused#::String)
@ VSCodeServer ~/.vscode-server/extensions/julialang.language-julia-1.2.5/scripts/packages/VSCodeServer/src/repl.jl:149
however, this works with using Preference in the REPL
julia>using Preferences
julia>load_preference(PkgModule, "color")
Dict{String, Any} with 1 entry:"name"=>"light_blue"
The text was updated successfully, but these errors were encountered:
one can create a package to test this, the Project.toml looks like following
the
src/PkgModule.jl
looks like thiswhile I'm expecting color to be loaded as a
Dict
, but I'm gettinghowever, this works with using Preference in the REPL
The text was updated successfully, but these errors were encountered: