@@ -135,5 +135,32 @@ function irrational(sym::Symbol, val::Union{Float64,Expr}, def::Union{Symbol,Exp
135135 @assert isa (big ($ esym), BigFloat)
136136 @assert Float64 ($ esym) == Float64 (big ($ esym))
137137 @assert Float32 ($ esym) == Float32 (big ($ esym))
138+
139+ # https://github.com/JuliaLang/julia/pull/55886 removed these effects for generic `AbstractIrrational` subtypes
140+ @static if isdefined (Base, :_throw_argument_error_irrational_to_rational_bigint )
141+ function Base. Rational {$BigInt} (:: $eT )
142+ Base. _throw_argument_error_irrational_to_rational_bigint ()
143+ end
144+ end
145+ @static if isdefined (Base, :_irrational_to_rational )
146+ Base. @assume_effects :foldable function Base. Rational {T} (x:: $eT ) where {T<: Integer }
147+ Base. _irrational_to_rational (T, x)
148+ end
149+ end
150+ @static if isdefined (Base, :_irrational_to_float )
151+ Base. @assume_effects :foldable function (:: Type{T} )(x:: $eT , r:: RoundingMode ) where {T<: Union{Float32,Float64} }
152+ Base. _irrational_to_float (T, x, r)
153+ end
154+ end
155+ @static if isdefined (Base, :_rationalize_irrational )
156+ Base. @assume_effects :foldable function Base. rationalize (:: Type{T} , x:: $eT ; tol:: Real = 0 ) where {T<: Integer }
157+ Base. _rationalize_irrational (T, x, tol)
158+ end
159+ end
160+ @static if isdefined (Base, :_lessrational )
161+ Base. @assume_effects :foldable function Base. lessrational (rx:: Rational , x:: $eT )
162+ Base. _lessrational (rx, x)
163+ end
164+ end
138165 end
139166end
0 commit comments