Skip to content

Commit

Permalink
irrational + promote_type had the same problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed May 1, 2022
1 parent 5d39b4d commit eff2f5e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/irrationals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract type AbstractIrrational <: Real end
Number type representing an exact irrational value denoted by the
symbol `sym`, such as [`π`](@ref pi), [`ℯ`](@ref) and [`γ`](@ref Base.MathConstants.eulergamma).
See also [`@irrational`], [`AbstractIrrational`](@ref).
See also [`@irrational`](@ref), [`AbstractIrrational`](@ref).
"""
struct Irrational{sym} <: AbstractIrrational end

Expand Down
15 changes: 14 additions & 1 deletion base/promotion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,25 @@ promote_result(::Type{T},::Type{S},::Type{Bottom},::Type{Bottom}) where {T,S} =
Convert all arguments to a common type, and return them all (as a tuple).
If no arguments can be converted, an error is raised.
See also: [`promote_type`], [`promote_rule`].
See also: [`promote_type`](@ref), [`promote_rule`](@ref).
# Examples
```jldoctest
julia> promote(Int8(1), Float16(4.5), Float32(4.1))
(1.0f0, 4.5f0, 4.1f0)
julia> promote_type(Int8, Float16, Float32)
Float32
julia> reduce(Base.promote_typejoin, (Int8, Float16, Float32))
Real
julia> promote(1, "x")
ERROR: promotion of types Int64 and String failed to change any arguments
[...]
julia> promote_type(Int, String)
Any
```
"""
function promote end
Expand Down

0 comments on commit eff2f5e

Please sign in to comment.