Skip to content

No-arg ScopedValues.@with doesn't like being in a scope #56017

@IanButterworth

Description

@IanButterworth
julia> x = Base.ScopedValues.ScopedValue(1)
Base.ScopedValues.ScopedValue{Int64}(1)

julia> Base.ScopedValues.@with x => 2 begin
           Base.ScopedValues.@with begin
               @show x
           end
       end
ERROR: MethodError: Cannot `convert` an object of type Base.ScopedValues.Scope to an object of type Base.PersistentDict{Base.ScopedValues.ScopedValue, Any}
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, ::T) where T<:AbstractDict
   @ Base abstractdict.jl:571
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:129
  convert(::Type{T}, ::AbstractDict) where T<:AbstractDict
   @ Base abstractdict.jl:573

Stacktrace:
 [1] Base.ScopedValues.Scope(values::Base.ScopedValues.Scope)
   @ Base.ScopedValues ./scopedvalues.jl:85
 [2] top-level scope
   @ REPL[3]:2
julia> versioninfo()
Julia Version 1.12.0-DEV.1315
Commit bb5aa5bd16* (2024-10-06 02:17 UTC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions