ronantakizawa/codereview-bench huggingface dataset:
Repository: JuliaLang/julia
File: base/pair.jl (Julia)

Code before:
"foo"

julia> for x in p
           println(x)
       end
foo
7

julia> replace.(["xops", "oxps"], "x" => "o")
2-element Vector{String}:
 "oops"
 "oops"
```
"""
Pair, =>

eltype(p::Type{Pair{A, B}}) where {A, B} = Union{A, B}
iterate(p::Pair, i=1) = i > 2 ? nothing : (getfield(p, i), i + 1)
indexed_iterate(p::Pair, i::Int, state=1) = (getfield(p, i), i + 1)

const _pairhash_seed = if UInt === UInt64
    0x94cb2bb20a28ce96
else
    0x1f60a087
end::UInt
hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, hash(_pairhash_seed, h)))

==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second)
isequal(p::Pair, q::Pair) = isequal(p.first,q.first)::Bool & isequal(p.second,q.second)::Bool

isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first),
                                                             isless(p.second,q.second))
getindex(p::Pair,i::Int) = getfield(p,i)
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i))
reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first)

firstindex(p::Pair) = 1
lastindex(p::Pair) = 2
length(p::Pair) = 2
first(p::Pair) = p.first
last(p::Pair) = p.second

convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x
function convert(::Type{Pair{A,B}}, x::Pair) where {A,B}
    a = getfield(x, :first)
    a isa A || (a = convert(A, a))
    b = getfield(x, :second)
    b isa B || (b = convert(B, b))
    return Pair{A,B}(a, b)::Pair{A,B}
end


Review comment (suggestion):
```suggestion
hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, _pairhash_seed - 3h))
```

Code after:
"foo"

julia> for x in p
           println(x)
       end
foo
7

julia> replace.(["xops", "oxps"], "x" => "o")
2-element Vector{String}:
 "oops"
 "oops"
```
"""
Pair, =>

eltype(p::Type{Pair{A, B}}) where {A, B} = Union{A, B}
iterate(p::Pair, i=1) = i > 2 ? nothing : (getfield(p, i), i + 1)
indexed_iterate(p::Pair, i::Int, state=1) = (getfield(p, i), i + 1)

let seed = (UInt === UInt64) ? 0x94cb2bb20a28ce96 : 0x1f60a087
    global hash
    hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, xor(seed, h)))
end

==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second)
isequal(p::Pair, q::Pair) = isequal(p.first,q.first)::Bool & isequal(p.second,q.second)::Bool

isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first),
                                                             isless(p.second,q.second))
getindex(p::Pair,i::Int) = getfield(p,i)
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i))
reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first)

firstindex(p::Pair) = 1
lastindex(p::Pair) = 2
length(p::Pair) = 2
first(p::Pair) = p.first
last(p::Pair) = p.second

convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x
function convert(::Type{Pair{A,B}}, x::Pair) where {A,B}
    a = getfield(x, :first)
    a isa A || (a = convert(A, a))
    b = getfield(x, :second)
    b isa B || (b = convert(B, b))
    return Pair{A,B}(a, b)::Pair{A,B}
end

promote_rule(::Type{Pair{A1,B1}}, ::Type{Pair{A2,B2}}) where {A1,B1,A2,B2} =
    Pair{promote_type(A1, A2), promote_type(B1, B2)}
Repository: JuliaLang/julia
File: base/pair.jl (Julia)

Code before:
"foo"

julia> for x in p
           println(x)
       end
foo
7

julia> replace.(["xops", "oxps"], "x" => "o")
2-element Vector{String}:
 "oops"
 "oops"
```
"""
Pair, =>

eltype(p::Type{Pair{A, B}}) where {A, B} = Union{A, B}
iterate(p::Pair, i=1) = i > 2 ? nothing : (getfield(p, i), i + 1)
indexed_iterate(p::Pair, i::Int, state=1) = (getfield(p, i), i + 1)

const _pairhash_seed = if UInt === UInt64
    0x94cb2bb20a28ce96
else
    0x1f60a087
end::UInt
hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, _pairhash_seed - 3h))

==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second)
isequal(p::Pair, q::Pair) = isequal(p.first,q.first)::Bool & isequal(p.second,q.second)::Bool

isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first),
                                                             isless(p.second,q.second))
getindex(p::Pair,i::Int) = getfield(p,i)
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i))
reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first)

firstindex(p::Pair) = 1
lastindex(p::Pair) = 2
length(p::Pair) = 2
first(p::Pair) = p.first
last(p::Pair) = p.second

convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x
function convert(::Type{Pair{A,B}}, x::Pair) where {A,B}
    a = getfield(x, :first)
    a isa A || (a = convert(A, a))
    b = getfield(x, :second)
    b isa B || (b = convert(B, b))
    return Pair{A,B}(a, b)::Pair{A,B}
end


Review comment (suggestion):
```suggestion
hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, xor(_pairhash_seed, h)))
```

Code after:
"foo"

julia> for x in p
           println(x)
       end
foo
7

julia> replace.(["xops", "oxps"], "x" => "o")
2-element Vector{String}:
 "oops"
 "oops"
```
"""
Pair, =>

eltype(p::Type{Pair{A, B}}) where {A, B} = Union{A, B}
iterate(p::Pair, i=1) = i > 2 ? nothing : (getfield(p, i), i + 1)
indexed_iterate(p::Pair, i::Int, state=1) = (getfield(p, i), i + 1)

let seed = (UInt === UInt64) ? 0x94cb2bb20a28ce96 : 0x1f60a087
    global hash
    hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, xor(seed, h)))
end

==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second)
isequal(p::Pair, q::Pair) = isequal(p.first,q.first)::Bool & isequal(p.second,q.second)::Bool

isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first),
                                                             isless(p.second,q.second))
getindex(p::Pair,i::Int) = getfield(p,i)
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i))
reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first)

firstindex(p::Pair) = 1
lastindex(p::Pair) = 2
length(p::Pair) = 2
first(p::Pair) = p.first
last(p::Pair) = p.second

convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x
function convert(::Type{Pair{A,B}}, x::Pair) where {A,B}
    a = getfield(x, :first)
    a isa A || (a = convert(A, a))
    b = getfield(x, :second)
    b isa B || (b = convert(B, b))
    return Pair{A,B}(a, b)::Pair{A,B}
end

promote_rule(::Type{Pair{A1,B1}}, ::Type{Pair{A2,B2}}) where {A1,B1,A2,B2} =
    Pair{promote_type(A1, A2), promote_type(B1, B2)}
Repository: JuliaLang/julia
File: base/pair.jl (Julia)

Code before:

julia> typeof(p)
Pair{String, Int64}

julia> p.first
"foo"

julia> for x in p
           println(x)
       end
foo
7

julia> replace.(["xops", "oxps"], "x" => "o")
2-element Vector{String}:
 "oops"
 "oops"
```
"""
Pair, =>

eltype(p::Type{Pair{A, B}}) where {A, B} = Union{A, B}
iterate(p::Pair, i=1) = i > 2 ? nothing : (getfield(p, i), i + 1)
indexed_iterate(p::Pair, i::Int, state=1) = (getfield(p, i), i + 1)

const _pairhash_seed = if UInt === UInt64
    0x94cb2bb20a28ce96
else
    0x1f60a087
end
hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, xor(_pairhash_seed, h)))

==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second)
isequal(p::Pair, q::Pair) = isequal(p.first,q.first)::Bool & isequal(p.second,q.second)::Bool

isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first),
                                                             isless(p.second,q.second))
getindex(p::Pair,i::Int) = getfield(p,i)
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i))
reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first)

firstindex(p::Pair) = 1
lastindex(p::Pair) = 2
length(p::Pair) = 2
first(p::Pair) = p.first
last(p::Pair) = p.second

convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x
function convert(::Type{Pair{A,B}}, x::Pair) where {A,B}
    a = getfield(x, :first)
    a isa A || (a = convert(A, a))

Review comment (suggestion):
```suggestion
const _pairhash_seed = 0x94cb2bb20a28ce96 % UInt
```

code golfing is fun

Code after:

julia> typeof(p)
Pair{String, Int64}

julia> p.first
"foo"

julia> for x in p
           println(x)
       end
foo
7

julia> replace.(["xops", "oxps"], "x" => "o")
2-element Vector{String}:
 "oops"
 "oops"
```
"""
Pair, =>

eltype(p::Type{Pair{A, B}}) where {A, B} = Union{A, B}
iterate(p::Pair, i=1) = i > 2 ? nothing : (getfield(p, i), i + 1)
indexed_iterate(p::Pair, i::Int, state=1) = (getfield(p, i), i + 1)

let seed = (UInt === UInt64) ? 0x94cb2bb20a28ce96 : 0x1f60a087
    global hash
    hash(p::Pair, h::UInt) = hash(p.second, hash(p.first, xor(seed, h)))
end

==(p::Pair, q::Pair) = (p.first==q.first) & (p.second==q.second)
isequal(p::Pair, q::Pair) = isequal(p.first,q.first)::Bool & isequal(p.second,q.second)::Bool

isless(p::Pair, q::Pair) = ifelse(!isequal(p.first,q.first), isless(p.first,q.first),
                                                             isless(p.second,q.second))
getindex(p::Pair,i::Int) = getfield(p,i)
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i))
reverse(p::Pair{A,B}) where {A,B} = Pair{B,A}(p.second, p.first)

firstindex(p::Pair) = 1
lastindex(p::Pair) = 2
length(p::Pair) = 2
first(p::Pair) = p.first
last(p::Pair) = p.second

convert(::Type{Pair{A,B}}, x::Pair{A,B}) where {A,B} = x
function convert(::Type{Pair{A,B}}, x::Pair) where {A,B}
    a = getfield(x, :first)
    a isa A || (a = convert(A, a))
    b = getfield(x, :second)
    b isa B || (b = convert(B, b))
Repository: JuliaLang/julia
File: base/show.jl (Julia)

Code before:
# This file is a part of Julia. License is MIT: https://julialang.org/license

using .Compiler: has_typevar

function show(io::IO, ::MIME"text/plain", u::UndefInitializer)
    show(io, u)
    get(io, :compact, false)::Bool && return
    print(io, ": array initializer with undefined values")
end

# first a few multiline show functions for types defined before the MIME type:

show(io::IO, ::MIME"text/plain", r::AbstractRange) = show(io, r) # always use the compact form for printing ranges

function show(io::IO, ::MIME"text/plain", r::UnitRange)
    show(io, first(r))
    print(io, ':')
    show(io, last(r))
    if !get(io, :compact, false) && isempty(r)
        print(io, " (empty range)")
    end
end

function show(io::IO, ::MIME"text/plain", r::LinRange)
    isempty(r) && return show(io, r)
    # show for LinRange, e.g.
    # range(1, stop=3, length=7)
    # 7-element LinRange{Float64}:
    #   1.0,1.33333,1.66667,2.0,2.33333,2.66667,3.0
    summary(io, r)
    println(io, ":")
    print_range(io, r)
end

function show(io::IO, ::MIME"text/plain", r::LogRange)  # display LogRange like LinRange
    isempty(r) && return show(io, r)
    summary(io, r)
    println(io, ":")
    print_range(io, r, " ", ", ", "", " \u2026 ")
end

function _isself(ft::DataType)
    ftname = ft.name
    isdefined(ftname, :mt) || return false

Review comment (security):
I'd type assert `Bool` here just to be safe, because `typeof(io)` is often not known concretely at compilation time (`stdout` is a global variable that's not concretely typed). Might make some code less vulnerable to invalidation.

```suggestion
    if !(get(io, :compact, false)::Bool) && isempty(r)
```

Code after:
# This file is a part of Julia. License is MIT: https://julialang.org/license

using .Compiler: has_typevar

function show(io::IO, ::MIME"text/plain", u::UndefInitializer)
    show(io, u)
    get(io, :compact, false)::Bool && return
    print(io, ": array initializer with undefined values")
end

# first a few multiline show functions for types defined before the MIME type:

show(io::IO, ::MIME"text/plain", r::AbstractRange) = show(io, r) # always use the compact form for printing ranges

function show(io::IO, ::MIME"text/plain", r::UnitRange)
    show(io, r)
    if !(get(io, :compact, false)::Bool) && isempty(r)
        print(io, " (empty range)")
    end
end

function show(io::IO, ::MIME"text/plain", r::LinRange)
    isempty(r) && return show(io, r)
    # show for LinRange, e.g.
    # range(1, stop=3, length=7)
    # 7-element LinRange{Float64}:
    #   1.0,1.33333,1.66667,2.0,2.33333,2.66667,3.0
    summary(io, r)
    println(io, ":")
    print_range(io, r)
end

function show(io::IO, ::MIME"text/plain", r::LogRange)  # display LogRange like LinRange
    isempty(r) && return show(io, r)
    summary(io, r)
    println(io, ":")
    print_range(io, r, " ", ", ", "", " \u2026 ")
end

function _isself(ft::DataType)
    ftname = ft.name
    isdefined(ftname, :mt) || return false
    name = ftname.mt.name
    mod = parentmodule(ft)  # NOTE: not necessarily the same as ft.name.mt.module
Repository: JuliaLang/julia
File: src/llvm-final-gc-lowering-mmtk.cpp (C++)

Code before:
// This file is a part of Julia. License is MIT: https://julialang.org/license

#include "llvm-gc-interface-passes.h"

#define DEBUG_TYPE "mmtk_final_gc_lowering"
STATISTIC(GCAllocBytesCount, "Number of lowered GCAllocBytesFunc intrinsics");

Value* FinalLowerGC::lowerGCAllocBytes(CallInst *target, Function &F)
{
    ++GCAllocBytesCount;
    CallInst *newI;

    IRBuilder<> builder(target);
    auto ptls = target->getArgOperand(0);
    auto type = target->getArgOperand(2);
    uint64_t derefBytes = 0;
    if (auto CI = dyn_cast<ConstantInt>(target->getArgOperand(1))) {
        size_t sz = (size_t)CI->getZExtValue();
        // This is strongly architecture and OS dependent
        int osize;
        int offset = jl_gc_classify_pools(sz, &osize);
        if (offset < 0) {
            newI = builder.CreateCall(
                bigAllocFunc,
                { ptls, ConstantInt::get(T_size, sz + sizeof(void*)), type });
            if (sz > 0)
                derefBytes = sz;
        }
        else {
            // In this case instead of lowering julia.gc_alloc_bytes to jl_gc_small_alloc

Review comment (bug):
Will the passes be ever used together? I assume no. Then I would prefer to use one debug string across both final lower implementation so that I don't need to remember which GC implementation I have

Code after:
// This file is a part of Julia. License is MIT: https://julialang.org/license

#include "llvm-gc-interface-passes.h"

#define DEBUG_TYPE "final_gc_lowering"
STATISTIC(GCAllocBytesCount, "Number of lowered GCAllocBytesFunc intrinsics");

Value* FinalLowerGC::lowerGCAllocBytes(CallInst *target, Function &F)
{
    ++GCAllocBytesCount;
    CallInst *newI;

    IRBuilder<> builder(target);
    auto ptls = target->getArgOperand(0);
    auto type = target->getArgOperand(2);
    uint64_t derefBytes = 0;
    if (auto CI = dyn_cast<ConstantInt>(target->getArgOperand(1))) {
        size_t sz = (size_t)CI->getZExtValue();
        // This is strongly architecture and OS dependent
        int osize;
        int offset = jl_gc_classify_pools(sz, &osize);
        if (offset < 0) {
            newI = builder.CreateCall(
                bigAllocFunc,
                { ptls, ConstantInt::get(T_size, sz + sizeof(void*)), type });
            if (sz > 0)
                derefBytes = sz;
        }
        else {
            // In this case instead of lowering julia.gc_alloc_bytes to jl_gc_small_alloc
Repository: JuliaLang/julia
File: test/ryu.jl (Julia)

Code before:
    end
end

# function testfloats(T)
#     x = floatmin(T)
#     i = 0
#     fails = 0
#     success = 0
#     while x < floatmax(T)
#         test = parse(T, Ryu.writeshortest(x)) == x
#         if !test

#             fails += 1
#         else
#             success += 1
#         end
#         x = nextfloat(x)
#         i += 1

#     end
#     return fails / (fails + success)
# end

@testset "Regression" begin
    @test "-0.00010014" == Ryu.writeshortest(Float16(-0.00010014)) #longest Float16
end
end # Float16

@testset "writeshortest(::AbstractVector, pos, ...)" begin
    @testset for Vec in (Vector{UInt8}, Memory{UInt8})
        buf = Vec(undef, 4)
        @test Ryu.writeshortest(buf, 1, -0.0) == 5
        @test String(buf) == "-0.0"

        buf = Vec(undef, 100)
        xx = 4.7223665f21
        expected = "4.7223665e21"
        start_pos = 42
        nwritten = length(expected)
        end_pos = start_pos + nwritten
        @test Ryu.writeshortest(buf, start_pos, xx) == end_pos
        @test String(buf[start_pos:end_pos-1]) == expected
    end
end

@testset "Ryu.writefixed" begin
    @testset "Basic" begin
        @test Ryu.writefixed(todouble(false, 1234, 99999), 0) ==
            "3291009114715486435425664845573426149758869524108446525879746560"
    end
    @testset "Zero" begin

Review comment (suggestion):
```suggestion
@test "-0.00010014" == Ryu.writeshortest(Float16(-0.00010014)) #longest Float16
```

Code after:
    end
end

# function testfloats(T)
#     x = floatmin(T)
#     i = 0
#     fails = 0
#     success = 0
#     while x < floatmax(T)
#         test = parse(T, Ryu.writeshortest(x)) == x
#         if !test

#             fails += 1
#         else
#             success += 1
#         end
#         x = nextfloat(x)
#         i += 1

#     end
#     return fails / (fails + success)
# end

@test "-0.00010014" == Ryu.writeshortest(Float16(-0.00010014)) #longest Float16
end # Float16

@testset "writeshortest(::AbstractVector, pos, ...)" begin
    @testset for Vec in (Vector{UInt8}, Memory{UInt8})
        buf = Vec(undef, 4)
        @test Ryu.writeshortest(buf, 1, -0.0) == 5
        @test String(buf) == "-0.0"

        buf = Vec(undef, 100)
        xx = 4.7223665f21
        expected = "4.7223665e21"
        start_pos = 42
        nwritten = length(expected)
        end_pos = start_pos + nwritten
        @test Ryu.writeshortest(buf, start_pos, xx) == end_pos
        @test String(buf[start_pos:end_pos-1]) == expected
    end
end

@testset "Ryu.writefixed" begin
    @testset "Basic" begin
        @test Ryu.writefixed(todouble(false, 1234, 99999), 0) ==
            "3291009114715486435425664845573426149758869524108446525879746560"
    end
    @testset "Zero" begin
        @test Ryu.writefixed(0.0, 4) == "0.0000"
        @test Ryu.writefixed(0.0, 3) == "0.000"
Repository: JuliaLang/julia
File: base/docs/basedocs.jl (Julia)

Code before:
replaceglobal!

"""
    setglobalonce!(module::Module, name::Symbol, value,
                  [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool

Atomically perform the operations to set a global to
a given value, only if it was previously not set.

!!! compat "Julia 1.11"
    This function requires Julia 1.11 or later.

See also [`setpropertyonce!`](@ref Base.setpropertyonce!) and [`setglobal!`](@ref).
"""
setglobalonce!

"""
    setconst!(module::Module, name::Symbol, [x])

Create or replace the constant `name` in `module` with the new value `x`.  When
replacing, `x` does not need to have the same type as the original constant.

When `x` is not given, `name` becomes an undefined constant; it cannot be read
or written to, but can be redefined.

Note that this function does not update the world age of the current task:
```
julia> begin
           const x = 1
           println(x)
           const x = 2
           println(x)
           Core.setconst!(Main, :x, 3)
           println(x)
       end
1
2
2
```

!!! compat "Julia 1.12"
    This function requires Julia 1.12 or later.  Redefining constants on earlier
    versions of Julia is unpredictable.

See also [`const`](@ref).
"""
Core.setconst!

"""
    typeof(x)


Review comment (suggestion):
```suggestion

Unlike the syntax `const`, calling this function does not insert `Core.@latestworld` to update the world age of the current frame:
```

Code after:
!!! compat "Julia 1.11"
    This function requires Julia 1.11 or later.

See also [`replaceproperty!`](@ref Base.replaceproperty!) and [`setglobal!`](@ref).
"""
replaceglobal!

"""
    setglobalonce!(module::Module, name::Symbol, value,
                  [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool

Atomically perform the operations to set a global to
a given value, only if it was previously not set.

!!! compat "Julia 1.11"
    This function requires Julia 1.11 or later.

See also [`setpropertyonce!`](@ref Base.setpropertyonce!) and [`setglobal!`](@ref).
"""
setglobalonce!

"""
    declare_const(module::Module, name::Symbol, [x])

Create or replace the constant `name` in `module` with the new value `x`.  When
replacing, `x` does not need to have the same type as the original constant.

When `x` is not given, `name` becomes an undefined constant; it cannot be read
or written to, but can be redefined.

Unlike the syntax `const`, calling this function does not insert `Core.@latestworld` to update the world age of the current frame:
```
julia> begin
           const x = 1
           println(x)
           const x = 2
           println(x)
           Core.declare_const(Main, :x, 3)
           println(x)
           Core.@latestworld
           println(x)
       end
1
2
2
3
```

!!! compat "Julia 1.12"
    This function requires Julia 1.12 or later.  Redefining constants on earlier
    versions of Julia is unpredictable.
Repository: JuliaLang/julia
File: base/docs/basedocs.jl (Julia)

Code before:
Create or replace the constant `name` in `module` with the new value `x`.  When
replacing, `x` does not need to have the same type as the original constant.

When `x` is not given, `name` becomes an undefined constant; it cannot be read
or written to, but can be redefined.

Note that this function does not update the world age of the current task:
```
julia> begin
           const x = 1
           println(x)
           const x = 2
           println(x)
           Core.setconst!(Main, :x, 3)
           println(x)
       end
1
2
2
```

!!! compat "Julia 1.12"
    This function requires Julia 1.12 or later.  Redefining constants on earlier
    versions of Julia is unpredictable.

See also [`const`](@ref).
"""
Core.setconst!

"""
    typeof(x)

Get the concrete type of `x`.

See also [`eltype`](@ref).

# Examples
```jldoctest
julia> a = 1//2;

julia> typeof(a)
Rational{Int64}

julia> M = [1 2; 3.5 4];

julia> typeof(M)
Matrix{Float64} (alias for Array{Float64, 2})
```
"""
typeof


Review comment (suggestion):
```suggestion
           Core.@latestworld
           println(x)
       end
1
2
2
3
```

Code after:
setglobalonce!

"""
    declare_const(module::Module, name::Symbol, [x])

Create or replace the constant `name` in `module` with the new value `x`.  When
replacing, `x` does not need to have the same type as the original constant.

When `x` is not given, `name` becomes an undefined constant; it cannot be read
or written to, but can be redefined.

Unlike the syntax `const`, calling this function does not insert `Core.@latestworld` to update the world age of the current frame:
```
julia> begin
           const x = 1
           println(x)
           const x = 2
           println(x)
           Core.declare_const(Main, :x, 3)
           println(x)
           Core.@latestworld
           println(x)
       end
1
2
2
3
```

!!! compat "Julia 1.12"
    This function requires Julia 1.12 or later.  Redefining constants on earlier
    versions of Julia is unpredictable.

See also [`const`](@ref).
"""
Core.declare_const

"""
   _import(to::Module, from::Module, asname::Symbol, [sym::Symbol, imported::Bool])

With all five arguments, imports `sym` from module `from` into `to` with name
`asname`.  `imported` is true for bindings created with `import` (set it to
false for `using A: ...`).

With only the first three arguments, creates a binding for the module `from`
with name `asname` in `to`.
"""
Core._import

"""
   _using(to::Module, from::Module)