Skip to content

Commit

Permalink
escape defexprs
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Sep 24, 2018
1 parent 93fdd2c commit 28d8f98
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ function _kwdef!(blk, params_args, call_args)
continue
end
defexpr = ei.args[2] # defexpr
push!(params_args, Expr(:kw, var, defexpr))
push!(params_args, Expr(:kw, var, esc(defexpr)))
push!(call_args, var)
blk.args[i] = lhs
elseif ei.head == :(::) && ei.args[1] isa Symbol
Expand Down
3 changes: 0 additions & 3 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -708,16 +708,13 @@ end
@test_throws AssertionError TestInnerConstructor(a="")
end


const outsidevar = 7
@kwdef struct TestOutsideVar
a::Int=outsidevar
end
@test TestOutsideVar() == TestOutsideVar(7)




@testset "exports of modules" begin
for (_, mod) in Base.loaded_modules
for v in names(mod)
Expand Down

0 comments on commit 28d8f98

Please sign in to comment.