Skip to content
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

Spurious method ambiguity error #20570

Closed
nalimilan opened this issue Feb 11, 2017 · 3 comments
Closed

Spurious method ambiguity error #20570

nalimilan opened this issue Feb 11, 2017 · 3 comments
Labels
types and dispatch Types, subtyping and method dispatch

Comments

@nalimilan
Copy link
Member

On current master the following code generates an ambiguity error which does not happen on 0.5. Commenting out the second convert method and uncommenting the third one fixes the problem. Yet adding free type parameters shouldn't make any difference.

immutable CategoricalValue{T, R <: Integer}
    pool::T
    level::R
end

Base.convert{T, R}(::Type{CategoricalValue{T, R}}, x::CategoricalValue{T, R}) = 1
Base.convert{T}(::Type{T}, x::CategoricalValue) = 2
#Base.convert{S, T, R}(::Type{T}, x::CategoricalValue{S, R}) = 3

x = CategoricalValue{String, Int}("a", 1);

convert(CategoricalValue{String, Int}, x)
@nalimilan nalimilan added the types and dispatch Types, subtyping and method dispatch label Feb 11, 2017
@yuyichao
Copy link
Contributor

Dup of #11597 (comment)

nalimilan added a commit to JuliaData/CategoricalArrays.jl that referenced this issue Feb 11, 2017
@nalimilan
Copy link
Member Author

I suspected this was already known, but it's hard for me to tell. Feel free to close.

nalimilan added a commit to JuliaData/CategoricalArrays.jl that referenced this issue Feb 11, 2017
@ararslan ararslan changed the title Spurious methord ambiguity error Spurious method ambiguity error Feb 11, 2017
@JeffBezanson
Copy link
Member

Dup of #6383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

No branches or pull requests

3 participants