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

Static.False()==true throws TypeError #108

Closed
jlchan opened this issue May 10, 2023 · 5 comments · Fixed by #110
Closed

Static.False()==true throws TypeError #108

jlchan opened this issue May 10, 2023 · 5 comments · Fixed by #110

Comments

@jlchan
Copy link
Contributor

jlchan commented May 10, 2023

In 1.8.5, Static.False() == true returns false. In v1.9, it throws a TypeError

julia> Static.False() == true
ERROR: TypeError: in typeassert, expected False, got a value of type True
Stacktrace:
 [1] convert
   @ ./number.jl:7 [inlined]
 [2] _promote
   @ ./promotion.jl:358 [inlined]
 [3] promote
   @ ./promotion.jl:381 [inlined]
 [4] ==(x::False, y::Bool)
   @ Base ./promotion.jl:449
 [5] top-level scope
   @ REPL[15]:1
@jlchan
Copy link
Contributor Author

jlchan commented May 10, 2023

Static.True() == false throws a TypeError as well

@Tokazama
Copy link
Collaborator

It seems to be due to promotion

@Tokazama
Copy link
Collaborator

Looks like we need Base.promote_rule(::Type{Bool}, T::Type{<:StaticNumber}) = promote_rule(Bool, eltype(T)) but it remains to be seen if it will cause invalidations.

chriselrod added a commit that referenced this issue May 10, 2023
@chriselrod
Copy link
Collaborator

Looks like we need Base.promote_rule(::Type{Bool}, T::Type{<:StaticNumber}) = promote_rule(Bool, eltype(T)) but it remains to be seen if it will cause invalidations.

That would probably be a better solution. Feel free to take over #109, or make your own PR and copy/paste the tests I added.

@jlchan
Copy link
Contributor Author

jlchan commented May 10, 2023

Added @Tokazama's promotion fix in #110. I need someone to approve workflows to check invalidations though.

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 a pull request may close this issue.

3 participants