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

Apparent Bug with BigInts in Composite Types #45332

Closed
ztultrebor opened this issue May 17, 2022 · 1 comment
Closed

Apparent Bug with BigInts in Composite Types #45332

ztultrebor opened this issue May 17, 2022 · 1 comment

Comments

@ztultrebor
Copy link

import Base: convert, promote_rule

struct Thing1 <: Number
    a::BigInt
end

convert(::Type{Thing1}, x::Int) = Thing1(x)

promote_rule(::Type{Thing1}, ::Type{<:Number}) = Thing1

The following example comparison is false:

Thing1(1) == 1

Now if Thing1.a were an Int, a Float64, a Rational{Int} or a ComplexF64 the above comparison is true. Is there some explanation for this or is it a bug?

@oscardssmith
Copy link
Member

This would work if you define ==(x::Thing1,y::Thing1). To the extent that it is a bug, it's a duplicate of #4648

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

No branches or pull requests

2 participants