Skip to content

Clean up verbose or old-style definitions #156

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

Merged
merged 1 commit into from
Apr 21, 2021

Conversation

kimikage
Copy link
Collaborator

@kimikage kimikage commented Apr 10, 2021

This was written with care so as not to change the behavior, but I think it needs further review.

minor changes

julia> -Gray(true)
ERROR: InexactError: Bool(-1) # master
Gray{Bool}(true) # this PR

Closes #124 (completely removed)

@codecov
Copy link

codecov bot commented Apr 10, 2021

Codecov Report

Merging #156 (2f4e60b) into master (7d02097) will decrease coverage by 0.45%.
The diff coverage is 98.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #156      +/-   ##
==========================================
- Coverage   92.99%   92.53%   -0.46%     
==========================================
  Files           2        2              
  Lines         214      201      -13     
==========================================
- Hits          199      186      -13     
  Misses         15       15              
Impacted Files Coverage Δ
src/ColorVectorSpace.jl 98.41% <98.18%> (-0.11%) ⬇️

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 7d02097...2f4e60b. Read the comment docs.

Copy link
Collaborator Author

@kimikage kimikage left a comment

Choose a reason for hiding this comment

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

supplementary notes

Comment on lines +51 to +53
isfinite(c::Colorant) = mapreducec(isfinite, &, true, c)
isinf(c::Colorant) = mapreducec(isinf, |, false, c)
isnan(c::Colorant) = mapreducec(isnan, |, false, c)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The specialization about Normed seems to be unnecessary thanks to constant propagation.
(BTW, FixedPoint would be more appropriate than Normed.)

end

# To help type inference
promote_rule(::Type{T}, ::Type{C}) where {T<:Real,C<:AbstractGray} = promote_type(T, eltype(C))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it would be good to move this rule to ColorTypes.jl since it does exist.
However, I am not comfortable with this rule. 😕

@kimikage kimikage marked this pull request as ready for review April 10, 2021 15:07
@kimikage
Copy link
Collaborator Author

I will address the issue #154 next, and in the meantime, if there are no comments on the issue #155, I will apply #155 (comment). I will then update the PR #153.

@kimikage kimikage merged commit 0bae88d into JuliaGraphics:master Apr 21, 2021
@kimikage kimikage deleted the cleanup branch April 21, 2021 09:57
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.

ColorType.gray(x::Real) is no longer needed
1 participant