-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Informative error in promotion with conflicting promote_rule
s
#57507
base: master
Are you sure you want to change the base?
Conversation
I think this fixes #13193? EDIT: it doesn't |
promote_rule
spromote_rule
s
promote_result(::Type,::Type,::Type{T},::Type{T}) where {T} = T | ||
# If only one promote_rule is defined, use the definition directly | ||
promote_result(::Type,::Type,::Type{T},::Type{Bottom}) where {T} = T | ||
promote_result(::Type,::Type,::Type{Bottom},::Type{T}) where {T} = T |
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 think these methods are not necessary
promote_result(::Type,::Type,::Type{T},::Type{T}) where {T} = T | |
# If only one promote_rule is defined, use the definition directly | |
promote_result(::Type,::Type,::Type{T},::Type{Bottom}) where {T} = T | |
promote_result(::Type,::Type,::Type{Bottom},::Type{T}) where {T} = T |
Don't use recursion, delete the `promote_result` function. Use loop known to terminate, because of a hardcoded limit on the iteration count. Closes JuliaLang#57507, this PR encompasses the fixes from that PR and is more comprehensive. Fixes JuliaLang#13193
This comment was marked as outdated.
This comment was marked as outdated.
Don't use recursion, delete the `promote_result` function. Use loop known to terminate, because of a hardcoded limit on the iteration count. Closes JuliaLang#57507, this PR encompasses the fixes from that PR and is more comprehensive. Fixes JuliaLang#13193
Don't use recursion, delete the `promote_result` function. Use loop known to terminate, because of a hardcoded limit on the iteration count. Closes JuliaLang#57507, this PR encompasses the fixes from that PR and is more comprehensive. Fixes JuliaLang#13193
I reduced the scope of that PR, so now it doesn't strictly encompass this PR. However, if my PR gets merged, this PR will not be a bugfix PR any more, seeing as my PR will already prevent a stack overflow. It might still make sense to merge both for the better error messages. |
Don't use recursion, delete the `promote_result` function. Use loop known to terminate, because of a hardcoded limit on the iteration count. Closes JuliaLang#57507, this PR encompasses the fixes from that PR and is more comprehensive. Fixes JuliaLang#13193
This is the non-controversial change from #56779 that improves the error message in type promotion.
On master, promotion with conflicting
promote_rule
definitions leads to a stack overflow:In this PR, this is changed to an
ArgumentError
: