Skip to content

setprecision(::Function, ::Type, ::Int) regression #55899

@nsajko

Description

@nsajko

Passes on v1.11, throws MethodError on v1.12:

using Test

struct Issue55899 end

const issue_55899_precision = Ref{Any}(123)

@testset "`setprecision` regression, issue #55899" begin
    function Base.precision(::Type{Issue55899})
        issue_55899_precision[]
    end

    function Base.setprecision(::Type{Issue55899}, p::Int)
        issue_55899_precision[] = p
    end

    function issue_55899_get_set_precision(p::Int)
        f = () -> precision(Issue55899)
        setprecision(f, Issue55899, p)
    end

    for p  (1, 10, 100)
        @test p === issue_55899_get_set_precision(p)
        @test 123 === precision(Issue55899)
    end
end

xref #51362

xref kalmarek/Arblib.jl#187

Metadata

Metadata

Assignees

No one assigned

    Labels

    bignumsBigInt and BigFloatregression 1.12Regression in the 1.12 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions