Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit 4ca67ef

Browse files
committed
Fix call to null_safe_op() for generic case
1 parent 5dcbb52 commit 4ca67ef

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/broadcast.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ end
5858
end
5959
end
6060

61+
eltype_nullable(x::Nullable) = eltype(x)
62+
eltype_nullable(x) = typeof(x)
6163
eltypes() = Tuple{}
62-
eltypes(x) = Tuple{eltype(x)}
63-
eltypes(x, xs...) = Tuple{eltype(x), eltypes(xs...).parameters...}
64+
eltypes(x) = Tuple{eltype_nullable(x)}
65+
eltypes(x, xs...) = Tuple{eltype_nullable(x), eltypes(xs...).parameters...}
6466

6567
hasnulls(x) = isnull(x)
6668
hasnulls(x, xs...) = hasnulls(x) | hasnulls(xs...)
@@ -73,10 +75,10 @@ for a function call `f(xs...)`, return null if any `x` in `xs` is null; otherwis
7375
return `f` applied to values of `xs`.
7476
"""
7577
@inline function broadcast_lift(f, xs...)
76-
if null_safe_op(f, eltypes(xs).parameters...)
78+
if null_safe_op(f, eltypes(xs...).parameters...)
7779
return @compat Nullable(f(unsafe_get.(xs)...), !hasnulls(xs...))
7880
else
79-
U = Core.Inference.return_type(f, eltypes(xs))
81+
U = Core.Inference.return_type(f, eltypes(xs...))
8082
if hasnulls(xs...)
8183
return Nullable{U}()
8284
else

0 commit comments

Comments
 (0)