You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to see how compatible LazyJSON would be with my Unmarshal.jl package.
While trying to get it to work, I believe I found a few problems in the Unmarshal package, that is being addressed, but I also found some problems with LazyJSON.
getindex works with a string, but not with a LazyJSON.String{String}.
Here is a minimum working example:
julia> using JSON, LazyJSON
julia> d = Dict("2" => "Test2","1" => "Test1")
Dict{String,String} with 2 entries:
"1" => "Test1"
"2" => "Test2"
julia> jl = LazyJSON.parse(JSON.json(d))
LazyJSON.Object{Nothing,String} with 2 entries:
"1" => "Test1"
"2" => "Test2"
julia> jl["1"]
"Test1"
julia> k = collect(keys(jl))[1]
"1"
julia> typeof(k)
LazyJSON.String{String}
julia> jl[k]
ERROR: MethodError: no method matching pointer(::LazyJSON.String{String})
Closest candidates are:
pointer(::String) at strings/string.jl:81
pointer(::String, ::Integer) at strings/string.jl:82
pointer(::SubString{String}) at strings/substring.jl:109
...
Stacktrace:
[1] get_ic(::LazyJSON.Object{Nothing,String}, ::LazyJSON.String{String}, ::Tuple{Int64,UInt8}, ::Int64) at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/LazyJSON.jl:343
[2] get_ic at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/LazyJSON.jl:327 [inlined]
[3] _get at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/AbstractDict.jl:19 [inlined]
[4] get at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/AbstractDict.jl:17 [inlined]
[5] getindex(::LazyJSON.Object{Nothing,String}, ::LazyJSON.String{String}) at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/AbstractDict.jl:10
[6] top-level scope at REPL[9]:1
julia> for iter keys(jl)
ERROR: syntax: invalid iteration specification
Stacktrace:
[1] top-level scope at REPL[9]:0
julia> for iter in keys(jl)
@show jl[iter]
end
ERROR: MethodError: no method matching pointer(::LazyJSON.String{String})
Closest candidates are:
pointer(::String) at strings/string.jl:81
pointer(::String, ::Integer) at strings/string.jl:82
pointer(::SubString{String}) at strings/substring.jl:109
...
Stacktrace:
[1] get_ic(::LazyJSON.Object{Nothing,String}, ::LazyJSON.String{String}, ::Tuple{Int64,UInt8}, ::Int64) at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/LazyJSON.jl:343
[2] get_ic at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/LazyJSON.jl:327 [inlined]
[3] _get at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/AbstractDict.jl:19 [inlined]
[4] get at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/AbstractDict.jl:17 [inlined]
[5] getindex(::LazyJSON.Object{Nothing,String}, ::LazyJSON.String{String}) at /Users/lwabeke/.julia/packages/LazyJSON/EmafJ/src/AbstractDict.jl:10
[6] macro expansion at ./show.jl:562 [inlined]
[7] top-level scope at ./REPL[11]:2
I will try looking into a PR, but my first attempt at providing a method for Base.pointer(::LazyJSON.String{String}), resulted in a Julia segfault. Logging it here, in case someone else is quicker or I get distracted before being able to look at the PR
The text was updated successfully, but these errors were encountered:
Hi
I was trying to see how compatible LazyJSON would be with my Unmarshal.jl package.
While trying to get it to work, I believe I found a few problems in the Unmarshal package, that is being addressed, but I also found some problems with LazyJSON.
getindex works with a string, but not with a LazyJSON.String{String}.
Here is a minimum working example:
I will try looking into a PR, but my first attempt at providing a method for Base.pointer(::LazyJSON.String{String}), resulted in a Julia segfault. Logging it here, in case someone else is quicker or I get distracted before being able to look at the PR
The text was updated successfully, but these errors were encountered: