JuliaStats / DataArrays.jl

DEPRECATED: Data structures that allow missing values
Other
53 stars 50 forks source link

DataArray & DataArray is ambiguous in 0.6 #262

Closed tawheeler closed 7 years ago

tawheeler commented 7 years ago

The following minimal example throws an ambiguity error:

using DataArrays
A = DataArray([true, false, true])
A &= DataArray([true, true, false])
ERROR: MethodError: &(::DataArrays.DataArray{Bool,1}, ::DataArrays.DataArray{Bool,1}) is ambiguous. Candidates:
  &(a::DataArrays.DataArray{Bool,N} where N, b::Union{AbstractArray{Bool,N} where N, Bool}) in DataArrays at /home/tim/.julia/v0.6/DataArrays/src/operators.jl:390
  &(b::Union{AbstractArray{Bool,N} where N, Bool}, a::DataArrays.DataArray{Bool,N} where N) in DataArrays at /home/tim/.julia/v0.6/DataArrays/src/operators.jl:390
ararslan commented 7 years ago

Thanks for the report. Also looks like we're overloading vectorized &, |, and $, which are deprecated for regular arrays (and $ is deprecated in general). So when this is addressed we should also make sure we switch to overloading broadcast(::typeof(&), ...), etc instead.

Edit: Which means your example should then be A .&= DataArray([true, true, false])

nalimilan commented 7 years ago

To be clear, in Julia 0.6, the A &= DataArray([true, true, false]) syntax is deprecated in favor of A .&= DataArray([true, true, false]), which already works. Though indeed it would be nice to print a deprecation rather than throwing a MethodError.

ararslan commented 7 years ago

Fixed on master, will be available in the next release (METADATA PR pending).