The broadcasted not operator .! (new in 0.6) is returning results with unexpected type when used directly on expressions containing a DataArray, e.g.
isa(.!isna.(x), DataArray) == true
whereas, if the BitArray result is stored in an intermediate variable:
y = isna.(x)
isa(.!y, BitArray) == true
Example:
0.6.0-rc3.0> using DataArrays
0.6.0-rc3.0> x = DataArray(1:3);
0.6.0-rc3.0> isna.(x)
3-element BitArray{1}:
false
false
false
# looks correct
0.6.0-rc3.0> .!isna.(x)
3-element DataArrays.DataArray{Bool,1}:
true
true
true
# return has become a DataArray{Bool}
0.6.0-rc3.0> y = isna.(x); .!y
3-element BitArray{1}:
true
true
true
# return is a BitArray as expected
Possible explanation - the code expansion looks rather more complicated than expected:
0.6.0-rc3.0> expand(:(.!f.(x)))
:($(Expr(:thunk, CodeInfo(:(begin
$(Expr(:thunk, CodeInfo(:(begin
global ##19#20
const ##19#20
$(Expr(:composite_type, Symbol("##19#20"), :((Core.svec)()), :((Core.svec)()), :(Core.Function), :((Core.svec)()), false, 0))
return
end))))
$(Expr(:method, false, :((Core.svec)((Core.svec)(##19#20, Core.Any), (Core.svec)())), CodeInfo(:(begin
#temp#@_3 = f(#temp#@_2)
return !#temp#@_3
end)), false))
#19 = $(Expr(:new, Symbol("##19#20")))
SSAValue(0) = #19
return (Base.broadcast)(SSAValue(0), x)
end)))))
versus:
0.6.0-rc3.0> expand(:(f.(x)))
:((Base.broadcast)(f, x))
0.6.0-rc3.0> expand(:(.!y))
:((Base.broadcast)(!, y))
which possibly suggests it is an upstream issue, independent of DataArrays.