From eff2f5e30c766ab70afeb0404c626625789544f6 Mon Sep 17 00:00:00 2001 From: Michael Abbott <32575566+mcabbott@users.noreply.github.com> Date: Sun, 1 May 2022 09:57:29 -0400 Subject: [PATCH] irrational + promote_type had the same problem --- base/irrationals.jl | 2 +- base/promotion.jl | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/base/irrationals.jl b/base/irrationals.jl index ecc3aff6138c1a..722672274d4dcf 100644 --- a/base/irrationals.jl +++ b/base/irrationals.jl @@ -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 diff --git a/base/promotion.jl b/base/promotion.jl index 26205530dcd9a1..53f003f77809d4 100644 --- a/base/promotion.jl +++ b/base/promotion.jl @@ -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