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

Some compat for 0.7 #70

Closed
wants to merge 2 commits into from
Closed

Some compat for 0.7 #70

wants to merge 2 commits into from

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Jan 10, 2018

No description provided.

@@ -17,7 +22,7 @@ using Base.Test, Missings, Compat
@test promote_type(Union{Int, Missing}, Union{Int, Missing}) == Union{Int, Missing}
@test promote_type(Union{Float64, Missing}, Union{String, Missing}) == Any
@test promote_type(Union{Float64, Missing}, Union{Int, Missing}) == Union{Float64, Missing}
@test promote_type(Union{Void, Missing, Int}, Float64) == Any
# @test_broken promote_type(Union{Nothing, Missing, Int}, Float64) == Any
Copy link
Member Author

Choose a reason for hiding this comment

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

@nalimilan, are we maybe missing a promote_rule in the Base definitions? I'm seeing

julia> promote_type(Union{Nothing, Missing, Int}, Float64)
Union{Missing, Float64}

on 0.7 (as of today).

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

But why comment this out? Isn't it still broken?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not broken on 0.6 though

Copy link
Member

Choose a reason for hiding this comment

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

How did tests pass then? :-/

Copy link
Member Author

Choose a reason for hiding this comment

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

If it's

@test promote_type(Union{Nothing, Missing, Int}, Float64) == Any

it passes on 0.6, fails on 0.7.

if it's

@test_broken promote_type(Union{Nothing, Missing, Int}, Float64) == Any

it passes 0.7, but fails 0.6 (because it's NOT broken on 0.6, "unexpected pass")

so to pass on 0.6 and 0.7, I just comment it out 😄

Copy link
Member

Choose a reason for hiding this comment

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

OK. Why not make it conditional on the version then?

@@ -206,15 +206,19 @@ else
Base.float(A::AbstractArray{Missing}) = A
end

if isdefined(Base, :adjoint)
Base.adjoint(d::Missing) = missing
Copy link
Member

Choose a reason for hiding this comment

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

This should be defined in Base as well, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, probably.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Also add indentation?

test/runtests.jl Outdated
@@ -1,4 +1,9 @@
using Base.Test, Missings, Compat
@static if VERSION < v"0.7.0-DEV.2005"
Copy link
Member

Choose a reason for hiding this comment

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

This can just be using Compat, Compat.Test, Missings

Base.iteratorsize(::Type{<:EachReplaceMissing{T}}) where {T} =
Base.iteratorsize(T)
Base.iteratoreltype(::Type{<:EachReplaceMissing{T}}) where {T} =
Base.iteratoreltype(T)
else
Base.IteratorSize(::Type{<:EachReplaceMissing{T}}) where {T} =
Copy link
Member

Choose a reason for hiding this comment

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

We should add this replacement to Compat.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was going to, but it's weird because IteratorSize is defined in 0.6 too.

Copy link
Member

Choose a reason for hiding this comment

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

Oh it is? Hm, that is weird.

Copy link
Member

Choose a reason for hiding this comment

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

Fredrik is adding it in Compat as Compat.IteratorSize, so we could use that if this PR is merged after his is merged and tagged.

@codecov-io
Copy link

codecov-io commented Jan 11, 2018

Codecov Report

Merging #70 into master will decrease coverage by 1.21%.
The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #70      +/-   ##
=========================================
- Coverage   94.11%   92.9%   -1.22%     
=========================================
  Files           1       1              
  Lines         153     155       +2     
=========================================
  Hits          144     144              
- Misses          9      11       +2
Impacted Files Coverage Δ
src/Missings.jl 92.9% <50%> (-1.22%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 392b205...23aac16. Read the comment docs.

@@ -286,6 +297,7 @@ Base.eltype(itr::EachReplaceMissing) = Missings.T(eltype(itr.x))
(v isa Missing ? itr.replacement : v, s)
end

@static if !isdefined(Base, :skipmissing)
Copy link
Member

Choose a reason for hiding this comment

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

Why @static here and not in other places? I'm not sure whether it's needed.

Copy link
Member

Choose a reason for hiding this comment

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

It's not necessary at the top level (though I think you can use it to get around deprecations from the parser) but it doesn't hurt.

@quinnj
Copy link
Member Author

quinnj commented Jan 18, 2018

pushed changes to #72 instead.

@quinnj quinnj closed this Jan 18, 2018
@quinnj quinnj deleted the jq/0.7 branch January 18, 2018 14:17
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.

4 participants