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

Possibly wrong TypeVar serialization with new typesystem #20324

Closed
amitmurthy opened this issue Jan 30, 2017 · 0 comments
Closed

Possibly wrong TypeVar serialization with new typesystem #20324

amitmurthy opened this issue Jan 30, 2017 · 0 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior parallelism Parallel or distributed computation types and dispatch Types, subtyping and method dispatch
Milestone

Comments

@amitmurthy
Copy link
Contributor

julia> abstract AbsFoo

julia> type Foo <: AbsFoo
           x
       end

julia> type Bar{T<:AbsFoo}
           x::T
       end

julia> x = Bar[Bar(Foo(1)) for i in 1:2]
2-element Array{Bar,1}:
 Bar{Foo}(Foo(1))
 Bar{Foo}(Foo(1))

julia> io=IOBuffer();

julia> serialize(io, x);

julia> seekstart(io);

julia> deserialize(io)
ERROR: MethodError: Cannot `convert` an object of type Bar{Foo} to an object of type Bar{T<:AbsFoo} where T<:AbsFoo
This may have arisen from a call to the constructor Bar{T<:AbsFoo} where T<:AbsFoo(...),
since type constructors fall back to convert methods.
Stacktrace:
 [1] setindex!(::Array{Bar{T<:AbsFoo} where T<:AbsFoo,1}, ::Bar{Foo}, ::Int64) at ./array.jl:489
 [2] deserialize_array(::SerializationState{Base.AbstractIOBuffer{Array{UInt8,1}}}) at ./serialize.jl:727
 [3] handle_deserialize(::SerializationState{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Int32) at ./serialize.jl:578
 [4] deserialize(::SerializationState{Base.AbstractIOBuffer{Array{UInt8,1}}}) at ./serialize.jl:550
 [5] deserialize(::Base.AbstractIOBuffer{Array{UInt8,1}}) at ./serialize.jl:547
@amitmurthy amitmurthy added parallelism Parallel or distributed computation types and dispatch Types, subtyping and method dispatch labels Jan 30, 2017
@amitmurthy amitmurthy mentioned this issue Jan 31, 2017
53 tasks
@JeffBezanson JeffBezanson self-assigned this Feb 13, 2017
@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Mar 25, 2017
@JeffBezanson JeffBezanson added this to the 0.6.0 milestone Mar 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior parallelism Parallel or distributed computation types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

2 participants