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

Do not load ScopedValues with using #55452

Merged
merged 6 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ include("weakkeydict.jl")

# ScopedValues
include("scopedvalues.jl")
using .ScopedValues

# metaprogramming
include("meta.jl")
Expand Down
2 changes: 1 addition & 1 deletion base/logging/logging.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module CoreLogging

import Base: isless, +, -, convert, show
import Base: ScopedValue, with, @with
import Base.ScopedValues: ScopedValue, with, @with

export
AbstractLogger,
Expand Down
8 changes: 4 additions & 4 deletions base/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ end
tie_breaker_is_to_even(::MPFRRoundingMode) = true

const ROUNDING_MODE = Ref{MPFRRoundingMode}(MPFRRoundNearest)
const CURRENT_ROUNDING_MODE = Base.ScopedValue{MPFRRoundingMode}()
const CURRENT_ROUNDING_MODE = Base.ScopedValues.ScopedValue{MPFRRoundingMode}()
const DEFAULT_PRECISION = Ref{Clong}(256)
const CURRENT_PRECISION = Base.ScopedValue{Clong}()
const CURRENT_PRECISION = Base.ScopedValues.ScopedValue{Clong}()
# Basic type and initialization definitions

# Warning: the constants are MPFR implementation details from
Expand Down Expand Up @@ -162,7 +162,7 @@ significand_limb_count(x::BigFloat) = div(sizeof(x._d), sizeof(Limb), RoundToZer
rounding_raw(::Type{BigFloat}) = something(Base.ScopedValues.get(CURRENT_ROUNDING_MODE), ROUNDING_MODE[])
setrounding_raw(::Type{BigFloat}, r::MPFRRoundingMode) = ROUNDING_MODE[]=r
function setrounding_raw(f::Function, ::Type{BigFloat}, r::MPFRRoundingMode)
Base.@with(CURRENT_ROUNDING_MODE => r, f())
Base.ScopedValues.@with(CURRENT_ROUNDING_MODE => r, f())
end


Expand Down Expand Up @@ -1109,7 +1109,7 @@ Note: `nextfloat()`, `prevfloat()` do not use the precision mentioned by
The `base` keyword requires at least Julia 1.8.
"""
function setprecision(f::Function, ::Type{BigFloat}, prec::Integer; base::Integer=2)
Base.@with(CURRENT_PRECISION => _convert_precision_from_base(prec, base), f())
Base.ScopedValues.@with(CURRENT_PRECISION => _convert_precision_from_base(prec, base), f())
end

setprecision(f::Function, prec::Integer; base::Integer=2) = setprecision(f, BigFloat, prec; base)
Expand Down