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

fix #41489: inference of +(::Rational, Rational) #41491

Merged
merged 3 commits into from
Jul 7, 2021
Merged

Conversation

simeonschaub
Copy link
Member

@simeonschaub simeonschaub commented Jul 6, 2021

Fixes #41489.

@simeonschaub simeonschaub added backport 1.7 compiler:inference Type inference rationals The Rational type and values thereof labels Jul 6, 2021
base/rational.jl Outdated
@@ -279,7 +279,7 @@ function -(x::Rational{T}) where T<:Unsigned
x
end

function +(x::Rational, y::Rational)
function +(x::Rational, y::Rational)::Rational
xp, yp = promote(x, y)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
xp, yp = promote(x, y)
xp, yp = promote(x, y)::NTuple{2,Rational}

How about adding annotations here instead ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, seems reasonable.

@aviatesk aviatesk merged commit cf4e1c4 into master Jul 7, 2021
@aviatesk aviatesk deleted the sds/plus_rational branch July 7, 2021 15:40
KristofferC pushed a commit that referenced this pull request Jul 19, 2021
* fix #41489: inference of `+(::Rational, Rational)`

* implement review comments

(cherry picked from commit cf4e1c4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference rationals The Rational type and values thereof
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1.7-beta2: type instability for matrix multiplication
3 participants