Skip to content

Commit f844c40

Browse files
committed
bad get type call now obsolete
1 parent 6d98a03 commit f844c40

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

src/Deprecated.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@ function Base.convert(::Type{DateTime}, ts::ZonedDateTime)
99
return DateTime(ts, Local)
1010
end
1111

12+
## ================================================================================
13+
## Deprecate before v0.20 - Kept longer with error
14+
##=================================================================================
15+
16+
function getTypeFromSerializationModule(dfg::G, moduleType::Symbol) where G <: AbstractDFG
17+
error("Deprecating getTypeFromSerializationModule(dfg,symbol), use getTypeFromSerializationModule(string) instead.")
18+
st = nothing
19+
try
20+
st = getfield(Main, Symbol(moduleType))
21+
catch ex
22+
@error "Unable to deserialize packed variableType $(moduleType)"
23+
io = IOBuffer()
24+
showerror(io, ex, catch_backtrace())
25+
err = String(take!(io))
26+
@error(err)
27+
end
28+
return st
29+
end
30+
1231
## ================================================================================
1332
## Deprecate before v0.19 - Kept longer with error
1433
##=================================================================================

src/services/Serialization.jl

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ end
7979

8080
typeModuleName(varT::Type{<:InferenceVariable}) = typeModuleName(varT())
8181

82+
"""
83+
$(SIGNATURES)
84+
Get a type from the serialization module.
85+
"""
8286
function getTypeFromSerializationModule(_typeString::AbstractString)
8387
@debug "DFG converting type string to Julia type" _typeString
8488
try
@@ -112,24 +116,6 @@ function getTypeFromSerializationModule(_typeString::AbstractString)
112116
nothing
113117
end
114118

115-
"""
116-
$(SIGNATURES)
117-
Get a type from the serialization module inside DFG.
118-
"""
119-
function getTypeFromSerializationModule(dfg::G, moduleType::Symbol) where G <: AbstractDFG
120-
@warn "Deprecating getTypeFromSerializationModule(dfg,symbol), use getTypeFromSerializationModule(string) instead." maxlog=10
121-
st = nothing
122-
try
123-
st = getfield(Main, Symbol(moduleType))
124-
catch ex
125-
@error "Unable to deserialize packed variableType $(moduleType)"
126-
io = IOBuffer()
127-
showerror(io, ex, catch_backtrace())
128-
err = String(take!(io))
129-
@error(err)
130-
end
131-
return st
132-
end
133119

134120
##==============================================================================
135121
## Variable Packing and unpacking
@@ -495,7 +481,7 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any}) where G <: Abstrac
495481
data = packedProps["data"]
496482
datatype = packedProps["fnctype"]
497483
@debug "DECODING factor type = '$(datatype)' for factor '$label'"
498-
packtype = getTypeFromSerializationModule(dfg, Symbol("Packed"*datatype))
484+
packtype = getTypeFromSerializationModule("Packed"*datatype)
499485

500486
# FIXME type instability from nothing to T
501487
packed = nothing

0 commit comments

Comments
 (0)