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

uniform comparison result type (Bool) #26

Merged
merged 3 commits into from
Oct 24, 2021
Merged

uniform comparison result type (Bool) #26

merged 3 commits into from
Oct 24, 2021

Conversation

JeffreySarnoff
Copy link
Contributor

Following up on #23,
this PR revises the comparison logic for StaticBool values so they result in a Bool value.
This behavior matches the comparison logic for the other Static types.

Following on from #23, change makes comparisons (`==`, `!=`, `<`, `<=`, `>`, `>=`) of two StaticBools return either `true` or `false` (which the other StaticTypes do under the same comparisons).
This tests StaticBool comparisons (`==`, `<`, `<=`) return Bool values, as do other StaticTypes when compared
restores StaticBool (`==`, `<`, `<=`) to yield Bool.
@codecov
Copy link

codecov bot commented Oct 23, 2021

Codecov Report

Merging #26 (ffe04bf) into master (ff00f12) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #26   +/-   ##
=======================================
  Coverage   98.36%   98.36%           
=======================================
  Files           7        7           
  Lines         429      429           
=======================================
  Hits          422      422           
  Misses          7        7           
Impacted Files Coverage Δ
src/bool.jl 100.00% <100.00%> (ø)

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 ff00f12...ffe04bf. Read the comment docs.

_lt(::False, ::True) = true
_lt(::True, ::True) = false
_lt(::False, ::False) = false
_lt(::True, ::False) = false
Copy link
Contributor Author

@JeffreySarnoff JeffreySarnoff Oct 23, 2021

Choose a reason for hiding this comment

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

hmm .. experimenting

@chriselrod
Copy link
Collaborator

chriselrod commented Oct 23, 2021

Sorry, deleted my comments (before seeing that you already responded) because I didn't realize _lt & co were just for Base.<. I was confusing these with the static methods like lt meant to produce True/False.

julia> Static.lt(static(4),static(6))
static(true)

@Tokazama
Copy link
Collaborator

@JeffreySarnoff, is this ready to merge?

@JeffreySarnoff
Copy link
Contributor Author

Yes. It does what it says it does. Nothing more. Nothing less.

@Tokazama Tokazama merged commit e8d4225 into SciML:master Oct 24, 2021
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.

3 participants