Skip to content

Commit

Permalink
fix issue 82 (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo authored Dec 5, 2022
1 parent c49ddc2 commit 0aa33c3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/from_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function from_dict_generated(::Type{OptionType}, value::Symbol) where {OptionTyp
elseif f_default isa PartialDefault
jl[:(!haskey($value, $key))] = :($var = $(f_default.lambda)($(f_default.vars...)))
else
jl[:(!haskey($value, $key))] = :($var = $f_default)
jl[:(!haskey($value, $key))] = :($var = $(QuoteNode(f_default)))
end

body = from_dict_generated(OptionType, OptionField(f_name), f_type, field_value)
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ include("test_issue50.jl")
include("test_reflected.jl")
include("test_auto_maybe_default.jl")
include("test_partial.jl")
include("test_empty_dict.jl")
include("test_empty_dict.jl")
include("test_issue82.jl")
13 changes: 13 additions & 0 deletions test/test_issue82.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Issue82

using Test
using Configurations

@option struct SymOpts
x::Symbol = :x
y::Symbol = :y
end

@test from_dict(SymOpts, Dict("x" => :xc)) == SymOpts(:xc, :y)

end # Issue82

0 comments on commit 0aa33c3

Please sign in to comment.