From 411155176b7ee50d2d1c349de256ecc538a9bc41 Mon Sep 17 00:00:00 2001 From: Cameron Prybol Date: Wed, 11 Oct 2017 17:34:28 -0700 Subject: [PATCH] Restrict zero function types Base only provides `zero(::Type{T}) where T<:Number`, not `zero(::Type{T}) where T`, and our method results in StackOverflows when called with `Any` when it should return an error. See https://github.com/JuliaData/DataFrames.jl/issues/1251 --- src/Nulls.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nulls.jl b/src/Nulls.jl index a9eaa50..9b68a03 100644 --- a/src/Nulls.jl +++ b/src/Nulls.jl @@ -67,7 +67,7 @@ for f in (:(!), :(+), :(-), :(Base.identity), :(Base.zero), @eval $(f)(d::Null) = null end -Base.zero(::Type{Union{T, Null}}) where {T} = zero(T) +Base.zero(::Type{Union{T, Null}}) where {T <: Number} = zero(T) # Binary operators/functions for f in (:(+), :(-), :(*), :(/), :(^),