Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors on 1.3 #1

Closed
KristofferC opened this issue Sep 5, 2019 · 2 comments
Closed

Errors on 1.3 #1

KristofferC opened this issue Sep 5, 2019 · 2 comments

Comments

@KristofferC
Copy link

The tests for the 1.3 release errors with

Anonymous Functions: Error During Test at /home/kristofferc/.julia/packages/BSONqs/XI8WW/test/runtests.jl:74
  Got exception outside of a @test
  MethodError: no method matching applychildren!(::BSONqs.var"##23#24"{Array{Any,1}}, ::UInt8)
  Closest candidates are:
    applychildren!(::Function, !Matched::Dict{Symbol,Any}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:32
    applychildren!(::Function, !Matched::Array{Any,1}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:33
    applychildren!(::Function, !Matched::Union{Nothing, Bool, Float64, Int32, Int64, Dict{Symbol,Any}, Array{Any,1}, Array{UInt8,1}, String, Symbol, Type{Union{}}}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:31
    ...
  Stacktrace:
   [1] backrefs!(::UInt8, ::Array{Any,1}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279
   [2] (::BSONqs.var"##23#24"{Array{Any,1}})(::UInt8) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279
   [3] applyvec!(::BSONqs.var"##23#24"{Array{Any,1}}, ::Array{Any,1}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:26
   [4] applychildren! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:33 [inlined]
   [5] backrefs! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   [6] #23 at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   [7] applychildren!(::BSONqs.var"##23#24"{Array{Any,1}}, ::BSONqs.TaggedStruct) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/intermediate.jl:107
   [8] backrefs! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   ... (the last 7 lines are repeated 2 more times)
   [23] (::BSONqs.var"##23#24"{Array{Any,1}})(::BSONqs.TaggedStruct) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279
   [24] applyvec!(::BSONqs.var"##23#24"{Array{Any,1}}, ::Array{Any,1}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:26
   [25] applychildren! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:33 [inlined]
   [26] backrefs! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   ... (the last 4 lines are repeated 2 more times)
   [35] #23 at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   [36] applychildren!(::BSONqs.var"##23#24"{Array{Any,1}}, ::BSONqs.TaggedStruct) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/intermediate.jl:107
   [37] backrefs! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   [38] (::BSONqs.var"##23#24"{Array{Any,1}})(::BSONqs.TaggedStruct) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279
   [39] applyvec!(::BSONqs.var"##23#24"{Array{Any,1}}, ::Array{Any,1}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:26
   [40] applychildren! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/BSONqs.jl:33 [inlined]
   [41] backrefs! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:279 [inlined]
   [42] backrefs! at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:285 [inlined]
   [43] parse(::Base.GenericIOBuffer{Array{UInt8,1}}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:289
   [44] load_compat(::Base.GenericIOBuffer{Array{UInt8,1}}) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:292
   [45] roundtrip(::Function, ::Symbol) at /home/kristofferc/.julia/packages/BSONqs/XI8WW/src/read.jl:302
   [46] top-level scope at /home/kristofferc/.julia/packages/BSONqs/XI8WW/test/runtests.jl:76
   [47] top-level scope at /home/kristofferc/julia/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
   [48] top-level scope at /home/kristofferc/.julia/packages/BSONqs/XI8WW/test/runtests.jl:75
   [49] top-level scope at /home/kristofferc/julia/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
   [50] top-level scope at /home/kristofferc/.julia/packages/BSONqs/XI8WW/test/runtests.jl:24
   [51] include at ./boot.jl:328 [inlined]
   [52] include_relative(::Module, ::String) at ./loading.jl:1105
   [53] include(::Module, ::String) at ./Base.jl:31
   [54] include(::String) at ./client.jl:432
   [55] top-level scope at none:6
   [56] eval(::Module, ::Any) at ./boot.jl:330
   [57] exec_options(::Base.JLOptions) at ./client.jl:271

Help understanding why is appreciated.

@richiejp
Copy link
Owner

richiejp commented Sep 5, 2019

Uhhg, that was painful.

mutable struct TaggedStruct <: TaggedStructType
  ttype::TaggedStructType
  data::Union{BSONArray}
end

BSONArray is Vector{Any}, but if we serialise a struct like

struct Foo
  i::UInt64
end

Then the UInt64 field is serialised as a tagged "struct" dictionary like

Dict{Symbol,Any} with 3 entries:
  :tag  => "struct"
  :type => Dict{Symbol,Any}(:tag=>"datatype",:params=>Any[],:name=>Any["Main", "Core", "UInt64"])
  :data => UInt8[0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]

So in this case data is a Vector{UInt8} (binary BSON type) which with the current struct definition gets silently converted to a Vector{Any}. If I change the data field to be a Union{Vector{UInt8}, BSONArray} then it works.

I suppose before it was not being silently converted, but instead the byte vector was allowed to be assigned to a Vector{Any} field. I think maybe it would have been better if it just failed in this case.

I will make a commit to fix this.

richiejp pushed a commit that referenced this issue Sep 5, 2019
@richiejp
Copy link
Owner

richiejp commented Sep 5, 2019

OK, I think this is fixed. Feel free to reopen if not, thanks.

@richiejp richiejp closed this as completed Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants