Skip to content

Commit

Permalink
Do not load ScopedValues with using (#55452)
Browse files Browse the repository at this point in the history
Stop loading `ScopedValues` with `using` so folks use
`ScopedValues.with` or `using ScopedValues` rather than `Base.with`.

Implements
#55095 (comment)

~Have to bump the StyledStrings stdlib to include
JuliaLang/StyledStrings.jl#80 Done

---------

Co-authored-by: Dilum Aluthge <[email protected]>
  • Loading branch information
LilithHafner and DilumAluthge authored Aug 15, 2024
1 parent c7309d0 commit e1aefeb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
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

2 comments on commit e1aefeb

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

Please sign in to comment.