Skip to content

Commit 2939cce

Browse files
committed
Handle Dicts better in interface definitions
1 parent fe4b26d commit 2939cce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/interface_def.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ macro dict_readable(arg)
6969
if !(field isa LineNumberNode)
7070
fieldname = string(field.args[1])
7171
fieldtype = field_type(field, string(tname))
72-
if fieldtype isa Expr && fieldtype.head == :curly && fieldtype.args[2] != :Any
72+
if fieldtype isa Expr && fieldtype.head == :curly && length(fieldtype.args)==3 && fieldtype.args[1]==:Dict
73+
f = :($(fieldtype)(i for i in pairs(dict[$fieldname])))
74+
elseif fieldtype isa Expr && fieldtype.head == :curly && fieldtype.args[2] != :Any
7375
f = :($(fieldtype.args[2]).(dict[$fieldname]))
7476
elseif fieldtype != :Any
7577
f = :($(fieldtype)(dict[$fieldname]))

0 commit comments

Comments
 (0)