diff --git a/Project.toml b/Project.toml index 6b552d1..e4361fa 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MLJModelInterface" uuid = "e80e1ace-859a-464e-9ed9-23947d8ae3ea" authors = ["Thibaut Lienart and Anthony Blaom"] -version = "1.12.1" +version = "1.12.2" [deps] InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" @@ -17,12 +17,12 @@ DataFrames = "1" Distances = "0.10" InteractiveUtils = "<0.0.1, 1" Markdown = "<0.0.1, 1" -OrderedCollections = "1" +OrderedCollections = "1,2" REPL = "<0.0.1, 1" Random = "<0.0.1, 1" ScientificTypes = "3" ScientificTypesBase = "3" -StatisticalTraits = "3.5" +StatisticalTraits = "3.5, 4.0" Tables = "1" Test = "<0.0.1, 1" julia = "1.6" diff --git a/src/equality.jl b/src/equality.jl index 5b0ed27..91857c2 100644 --- a/src/equality.jl +++ b/src/equality.jl @@ -144,8 +144,6 @@ end # equality and a corresponding definition of `in`. Base.isequal(m1::MLJType, m2::MLJType) = (m1 === m2) -# Note: To prevent julia crash, it seems we need to annotate the type -# of itr: function special_in(x, itr)::Union{Bool,Missing} for y in itr ismissing(y) && return missing @@ -154,9 +152,12 @@ function special_in(x, itr)::Union{Bool,Missing} return false end +# Note: To address some method ambiguities, it seems we need to annotate +# the type of itr: Base.in(x::MLJType, itr::Set) = special_in(x, itr) Base.in(x::MLJType, itr::AbstractVector{<:MLJType}) = special_in(x, itr) Base.in(x::MLJType, itr::AbstractRange{<:MLJType}) = special_in(x, itr) +Base.in(x::MLJType, itr::Base.ReshapedArray{<:MLJType,1}) = special_in(x, itr) Base.in(x::MLJType, itr::Tuple) = special_in(x, itr) Base.in(x::MLJType, itr::Tuple{(Any for _ in 1:32)..., Vararg{Any}}) = special_in(x, itr)