Skip to content

Commit

Permalink
fix #26979, incorrect typeassert in deserialize
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 4, 2018
1 parent ee2211c commit 901b240
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/Serialization/src/Serialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ function deserialize(s::AbstractSerializer, ::Type{Method})
name = deserialize(s)::Symbol
file = deserialize(s)::Symbol
line = deserialize(s)::Int32
sig = deserialize(s)::DataType
sig = deserialize(s)::Type
sparam_syms = deserialize(s)::SimpleVector
ambig = deserialize(s)::Union{Array{Any,1}, Nothing}
nargs = deserialize(s)::Int32
Expand Down
13 changes: 13 additions & 0 deletions stdlib/Serialization/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -519,3 +519,16 @@ let io = IOBuffer()
@test (b[5] & 0xf0) == 0
@test all(b[6:8] .== 0)
end

# issue #26979
let io = IOBuffer()
function gen_f(a::T) where T
f = x -> T(x)
return f
end
f = gen_f(1f0)
serialize(io, f)
seekstart(io)
f2 = deserialize(io)
@test f2(1) === 1f0
end

0 comments on commit 901b240

Please sign in to comment.