Open schlichtanders opened 7 months ago
I just build a tiny test example for Configurations which unforunately breaks. EDIT: simplified the example further
using Configurations: @option, from_dict @option struct OptionFails d::Union{Nothing, String} = nothing e::String end from_dict(OptionFails, Dict("d" => nothing, "e" => "hi"))
throws
ERROR: MethodError: no method matching haskey(::Nothing, ::String) Closest candidates are: haskey(::LibGit2.CachedCredentials, ::Any) @ LibGit2 ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/LibGit2/src/types.jl:1309 haskey(::LibGit2.GitTree, ::AbstractString) @ LibGit2 ~/.julia/juliaup/julia-1.10.2+0.x64.linux.gnu/share/julia/stdlib/v1.10/LibGit2/src/tree.jl:192 haskey(::RegexMatch, ::Union{AbstractString, Symbol}) @ Base regex.jl:279 ... Stacktrace: [1] macro expansion @ ./essentials.jl:0 [inlined] [2] from_dict_specialize(::Type{MyC8}, d::Dict{String, Union{Nothing, String}}) @ Main ~/.julia/packages/Configurations/Yxczn/src/codegen.jl:362 [3] from_dict(::Type{MyC8}, d::Dict{String, Union{Nothing, String}}; kw::@Kwargs{}) @ Configurations ~/.julia/packages/Configurations/Yxczn/src/from_dict.jl:46 [4] from_dict(::Type{MyC8}, d::Dict{String, Union{Nothing, String}}) @ Configurations ~/.julia/packages/Configurations/Yxczn/src/from_dict.jl:33 [5] top-level scope @ REPL[30]:1
Suprisingly just changing the variable names makes it work
@option struct OptionWorks a::Union{Nothing, String} = nothing b::String end from_dict(OptionWorks, Dict("a" => nothing, "b" => "hi"))
I just build a tiny test example for Configurations which unforunately breaks. EDIT: simplified the example further
throws
Suprisingly just changing the variable names makes it work