-
Notifications
You must be signed in to change notification settings - Fork 18
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
Jaeyeon/newdispatch #362
Jaeyeon/newdispatch #362
Changes from all commits
5b21da9
18ec4e3
1cdea3e
1d66e48
9c3876e
b2e16bc
77201af
6239cad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,32 +166,30 @@ | |
Base.:(-)(x::Limit)::Limit = limit(-x.val, -x.sign) | ||
|
||
#Crazy julia multiple dispatch stuff don't worry about it | ||
limit_types = [Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128, BigInt, Float32, Float64] | ||
for S in limit_types | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This for loop avoids method ambiguities on types that define e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I see that currently There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was also a random attempt to address the CI issues in continuous testing. While it makes the code cleaner, it introduces ambiguity. Since the CI now passes, I believe we no longer need this pull request. Let's close it. |
||
@eval begin | ||
@inline Base.promote_rule(::Type{Limit{T}}, ::Type{$S}) where {T} = Limit{promote_type(T, $S)} | ||
Base.convert(::Type{Limit{T}}, i::$S) where {T} = limit(convert(T, i)) | ||
Limit(i::$S) = Limit{$S}(i, tiny_zero()) | ||
(::Type{$S})(i::Limit{T}) where {T} = convert($S, i.val) | ||
Base.convert(::Type{$S}, i::Limit) = convert($S, i.val) | ||
Base.:(+)(x::Limit, y::$S)::Limit = x + limit(y) | ||
Base.:(+)(x::$S, y::Limit)::Limit = limit(x) + y | ||
Base.:(-)(x::Limit, y::$S)::Limit = x - limit(y) | ||
Base.:(-)(x::$S, y::Limit)::Limit = limit(x) - y | ||
Base.:(<)(x::Limit, y::$S) = x < limit(y) | ||
Base.:(<)(x::$S, y::Limit) = limit(x) < y | ||
Base.:(<=)(x::Limit, y::$S) = x <= limit(y) | ||
Base.:(<=)(x::$S, y::Limit) = limit(x) <= y | ||
Base.:(==)(x::Limit, y::$S) = x == limit(y) | ||
Base.:(==)(x::$S, y::Limit) = limit(x) == y | ||
Base.isless(x::Limit, y::$S) = x < limit(y) | ||
Base.isless(x::$S, y::Limit) = limit(x) < y | ||
Base.max(x::$S, y::Limit)::Limit = max(limit(x), y) | ||
Base.max(x::Limit, y::$S)::Limit = max(x, limit(y)) | ||
Base.min(x::$S, y::Limit)::Limit = min(limit(x), y) | ||
Base.min(x::Limit, y::$S)::Limit = min(x, limit(y)) | ||
end | ||
end | ||
Base.promote_rule(::Type{Limit{T}}, ::Type{S}) where {T, S<:Real} = Limit{promote_type(T, S)} | ||
Base.convert(::Type{Limit{T}}, i::Real) where {T} = limit(convert(T, i)) | ||
Limit(i::S) where {S<:Real} = Limit{S}(i, tiny_zero()) | ||
(::Type{S})(i::Limit{T}) where {T, S<:Real} = convert(S, i.val) | ||
Base.convert(::Type{S}, i::Limit) where {S<:Real} = convert(S, i.val) | ||
Base.:(+)(x::Limit, y::Real)::Limit = x + limit(y) | ||
Base.:(+)(x::Real, y::Limit)::Limit = limit(x) + y | ||
Base.:(-)(x::Limit, y::Real)::Limit = x - limit(y) | ||
Base.:(-)(x::Real, y::Limit)::Limit = limit(x) - y | ||
Base.:(<)(x::Limit, y::Real) = x < limit(y) | ||
Base.:(<)(x::Real, y::Limit) = limit(x) < y | ||
Base.:(<=)(x::Limit, y::Real) = x <= limit(y) | ||
Base.:(<=)(x::Real, y::Limit) = limit(x) <= y | ||
Base.:(==)(x::Limit, y::Real) = x == limit(y) | ||
Base.:(==)(x::Real, y::Limit) = limit(x) == y | ||
Base.isless(x::Limit, y::Real) = x < limit(y) | ||
Base.isless(x::Real, y::Limit) = limit(x) < y | ||
Base.max(x::Real, y::Limit)::Limit = max(limit(x), y) | ||
Base.max(x::Limit, y::Real)::Limit = max(x, limit(y)) | ||
Base.min(x::Real, y::Limit)::Limit = min(limit(x), y) | ||
Base.min(x::Limit, y::Real)::Limit = min(x, limit(y)) | ||
|
||
|
||
|
||
|
||
Base.promote_rule(::Type{Limit{T}}, ::Type{Limit{S}}) where {T, S} = Limit(promote_type(T, S)) | ||
Base.convert(::Type{Limit{T}}, i::Limit) where {T} = Limit{T}(convert(T, i.val), i.sign) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used to do it this way, but all the extra calls to simplify slowed the compiler down, so we avoid this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI tests on the main branch used to fail because the result of
simplify
was occasionally different on x64 Ubuntu Julia 1.6.7 when the Finch expression included a Limit.Therefore, I attempted to explicitly launch the
simplify
pass using this code snippet to verify if it works. In any case, it appears that your main branch now passes the continuous tests after your hash fix, so I assume the underlying issue was related to the static hash handling of the Limit type. Consequently, we can remove this change.