Skip to content

Package breaks if ran without inline #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eperim opened this issue Feb 20, 2018 · 2 comments
Closed

Package breaks if ran without inline #127

eperim opened this issue Feb 20, 2018 · 2 comments

Comments

@eperim
Copy link

eperim commented Feb 20, 2018

When I try to use the package in a session started with julia --inline=no it breaks. All errors during the tests seem to fall back to this:

categorical(CategoricalArrays.CategoricalArray{String,1,Int64,String,CategoricalArrays.CategoricalString{Int64},Union{}}, compress=false) R1=Int64 R2=Int64: Error During Test
  Got an exception of type MethodError outside of a @test
  MethodError: in(::CategoricalArrays.CategoricalString{Int64}, ::Base.KeyIterator{ObjectIdDict}) is ambiguous. Candidates:
    in(k, v::Base.KeyIterator) in Base at associative.jl:60
    in(x::Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R, y) in CategoricalArrays at /Users/ericperim/.julia/v0.6/CategoricalArrays/src/value.jl:118
  Possible fix, define
    in(::Union{CategoricalArrays.CategoricalString{R}, CategoricalArrays.CategoricalValue{T,R} where T} where R, ::Base.KeyIterator)

Note: in order to observe this behaviour it is necessary to use julia --inline=no test/runtests.jl, since if you run Pkg.test from inside the REPL it will use the default options (inline=yes).

@nalimilan
Copy link
Member

Good catch. It's funny that it happens only without inlining, but indeed it looks like this ambiguity needs to be fixed to be able to call deepcopy on CategoricalArray/CategoricalPool. Adding the following methods fixes the problem:

Base.in(x::CatValue, y::ObjectIdDict) = invoke(in, Tuple{Any, Base.KeyIterator}, x, keys(y))
Base.in(x::CatValue, y::Base.KeyIterator) = invoke(in, Tuple{Any, Base.KeyIterator}, x, y)

But I think I've found a better and simpler fix, which is to remove the offending methods. See #128.

@nalimilan
Copy link
Member

Fixed by #128.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants