Skip to content

Commit 710e899

Browse files
committed
No params in TypeParams for singleton types
1 parent 280a407 commit 710e899

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Serialization/main.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,17 @@ struct TypeParams{T, S}
167167
type::Type{T}
168168
params::S
169169

170-
function TypeParams(T::Type, args::Pair...)
171-
return new{T, typeof(args)}(T, args)
170+
function TypeParams(T::Type, params)
171+
if Base.issingletontype(T)
172+
return new{T, Nothing}(T, nothing)
173+
else
174+
return new{T, typeof(params)}(T, params)
175+
end
172176
end
173-
TypeParams(T::Type, obj) = new{T, typeof(obj)}(T, obj)
174177
end
175178

179+
TypeParams(T::Type, args::Pair...) = TypeParams(T, args)
180+
176181
params(tp::TypeParams) = tp.params
177182
type(tp::TypeParams) = tp.type
178183

0 commit comments

Comments
 (0)