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

Fix convert with Union{T, Nothing} #213

Merged
merged 1 commit into from
Sep 27, 2019
Merged

Fix convert with Union{T, Nothing} #213

merged 1 commit into from
Sep 27, 2019

Conversation

nalimilan
Copy link
Member

Fixes the append! problem reported at #172 (comment).

@nalimilan nalimilan mentioned this pull request Sep 27, 2019
@@ -87,9 +87,9 @@ Base.convert(::Type{Union{T, Nothing}}, x::T) where {T <: CatValue} = x
Base.convert(::Type{S}, x::T) where {S, T <: CatValue} =
T <: S ? x : convert(S, get(x))
Base.convert(::Type{Union{S, Missing}}, x::T) where {S, T <: CatValue} =
T <: S ? x : convert(S, get(x))
T <: Union{S, Missing} ? x : convert(Union{S, Missing}, get(x))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these two definitions for Nothing and Missing needed? It seems that by leaving https://github.com/JuliaData/CategoricalArrays.jl/pull/213/files#diff-0c97238b80ec111debf6823967ed4c9eR87 only (ie. the default convert) we should get exactly the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's due to ambiguities with methods defined in Base.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is the pain I have with DataFrames.jl every time I do a major redesign of something that touches Base.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully with #201 we will be able to simplify this.

@nalimilan nalimilan merged commit 13dfc1c into master Sep 27, 2019
@nalimilan nalimilan deleted the nl/nothing branch September 27, 2019 11:54
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

Successfully merging this pull request may close these issues.

2 participants