Potential compile bug related to keyword arguments and variable scope in 0.5

Hi

I encountered a bug and initially thought it was limited to the Plotlyjs package (https://github.com/sglyon/PlotlyJS.jl/issues/106), but as @sglyon showed it seems to be a more general Julia problem.

From my understanding it seems that when using variables from an outer scope with functions using keyword arguments.

I haven’t tested in a version of Julia other than listed in my original issue.

Suggested next steps on this?

It works in 0.4, tested with a slight adaption of @sglyon’s example:

f(;kwargs...) = Dict(kwargs)
let
    v = rand(5)
    global g # in 0.4 this syntax is needed
    function g()
        f(myvar=v)
    end
end
@show g() # errors in 0.5 and 0.6 but not 0.4

This seems like a regression to me. If not a regression, it would need at least a better error message. Unless there is other feedback here, please file an issue.