Skip to content

Commit 84badce

Browse files
committed
forgot to check if concretize was true in varname
1 parent 111f805 commit 84badce

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/varname.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,20 +455,20 @@ julia> @varname(x[1,2][1+5][45][3]).indexing
455455
Using `begin` in an indexing expression to refer to the first index requires at least
456456
Julia 1.5.
457457
"""
458-
macro varname(expr::Union{Expr, Symbol}, concretize=false)
458+
macro varname(expr::Union{Expr, Symbol}, concretize::Bool=false)
459459
return varname(expr, concretize)
460460
end
461461

462-
varname(sym::Symbol, concretize=false) = :($(AbstractPPL.VarName){$(QuoteNode(sym))}())
463-
function varname(expr::Expr, concretize=false)
462+
varname(sym::Symbol, concretize::Bool=false) = :($(AbstractPPL.VarName){$(QuoteNode(sym))}())
463+
function varname(expr::Expr, concretize::Bool=false)
464464
if Meta.isexpr(expr, :ref) || Meta.isexpr(expr, :.)
465465
# Split into object/base symbol and lens.
466466
sym_escaped, lens = Setfield.parse_obj_lens(expr)
467467
# Setfield.jl escapes the return symbol, so we need to unescape
468468
# to call `QuoteNode` on it.
469469
sym = drop_escape(sym_escaped)
470470

471-
return if Setfield.need_dynamic_lens(expr)
471+
return if concretize && Setfield.need_dynamic_lens(expr)
472472
:($(AbstractPPL.concretize)($(AbstractPPL.VarName){$(QuoteNode(sym))}($lens), $sym_escaped))
473473
else
474474
:($(AbstractPPL.VarName){$(QuoteNode(sym))}($lens))

0 commit comments

Comments
 (0)