Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
be5bc79
loading: fix ccall signature in _include_from_serialized (#57776)
vtjnash Mar 15, 2025
6f6157a
Make `haskey(::@Kwargs{item::Bool}, :item)` constant-fold (#59320)
topolarity Aug 20, 2025
172a745
Fix JET-reported issues in `BinaryPlatforms.triplet(::AbstractPlatfor…
lgoettgens Aug 21, 2025
6eb5f84
`@nospecialize` for `string_index_err` (#57604)
nsajko Aug 21, 2025
883e006
🤖 [backports-release-1.12] Bump the LinearAlgebra stdlib from 6cc0405…
DilumAluthgeBot Aug 25, 2025
3220a81
Make delete_binding operate in the latest world (#58043)
Keno Apr 8, 2025
66b6db7
bpart: Fix reresolution logic on export value changes (#59368)
Keno Aug 23, 2025
4aca0d6
Include inference time in `--trace-compile-timing` (#59220)
topolarity Aug 18, 2025
daa0b9e
Update the developer docs to reflect the use of JuliaSyntax.jl (#59300)
ajwheeler Aug 19, 2025
2e45512
Log a backtrace on entrance to type inference (#58124)
timholy Aug 21, 2025
843592e
Fix nospecializing Functions in `Union{Nothing,Function}` params (#59…
NHDaly Aug 21, 2025
7ea7202
docs(compat): Add missing compat admonition to IdSet docstring (#59290)
kunzaatko Aug 22, 2025
81ab4fc
aotcompile: destroy LLVM context after serializing combined module (#…
xal-0 Aug 22, 2025
e7424c0
Update Artifacts precompile statement (#59371)
JamesWrigley Aug 24, 2025
dd5c592
Fixup measurement for --trace-compile-timing w/ nested compilations. …
NHDaly Aug 25, 2025
ddc56a0
work around some closure capture boxing inference issues in loading (…
nsajko Aug 26, 2025
2841be9
atomics: correctly implement padding write of 11 byte atomics with 4 …
vtjnash Aug 26, 2025
2df5f57
Remove obsolete paragraph on struct redefinition from FAQ (#59399)
Liozou Aug 26, 2025
b420469
Correctly set the variant bits of uuid1 (#59428)
GunnarFarneback Aug 30, 2025
3a9511e
Add a long running warn to Base.runtests (#59288)
IanButterworth Aug 21, 2025
eef989c
Rename `_aligned_msize` to prevent conflict with mingw64 defintion (#…
Zentrik Apr 29, 2025
552d97c
openlibm 0.8.7 (#59312)
fxcoudert Aug 17, 2025
50e72b3
replcompletions: Try to make the test more robust (#59166)
Keno Jul 31, 2025
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
7 changes: 7 additions & 0 deletions Compiler/test/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6291,3 +6291,10 @@ end <: Bool
@test Base.infer_return_type((Module,Symbol,Vector{Any})) do m, n, xs
Core.get_binding_type(m, n, xs...)
end <: Type

# issue #59269
function haskey_inference_test()
kwargs = Core.compilerbarrier(:const, Base.pairs((; item = false)))
return haskey(kwargs, :item) ? nothing : Any[]
end
@inferred haskey_inference_test()
15 changes: 9 additions & 6 deletions base/binaryplatforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -520,14 +520,17 @@ function triplet(p::AbstractPlatform)
)

# Tack on optional compiler ABI flags
if libgfortran_version(p) !== nothing
str = string(str, "-libgfortran", libgfortran_version(p).major)
libgfortran_version_ = libgfortran_version(p)
if libgfortran_version_ !== nothing
str = string(str, "-libgfortran", libgfortran_version_.major)
end
if cxxstring_abi(p) !== nothing
str = string(str, "-", cxxstring_abi(p))
cxxstring_abi_ = cxxstring_abi(p)
if cxxstring_abi_ !== nothing
str = string(str, "-", cxxstring_abi_)
end
if libstdcxx_version(p) !== nothing
str = string(str, "-libstdcxx", libstdcxx_version(p).patch)
libstdcxx_version_ = libstdcxx_version(p)
if libstdcxx_version_ !== nothing
str = string(str, "-libstdcxx", libstdcxx_version_.patch)
end

# Tack on all extra tags
Expand Down
4 changes: 2 additions & 2 deletions base/essentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ end
Pairs{K, V, I, A}(data, itr) where {K, V, I, A} = $(Expr(:new, :(Pairs{K, V, I, A}), :(data isa A ? data : convert(A, data)), :(itr isa I ? itr : convert(I, itr))))
Pairs{K, V}(data::A, itr::I) where {K, V, I, A} = $(Expr(:new, :(Pairs{K, V, I, A}), :data, :itr))
Pairs{K}(data::A, itr::I) where {K, I, A} = $(Expr(:new, :(Pairs{K, eltype(A), I, A}), :data, :itr))
Pairs(data::A, itr::I) where {I, A} = $(Expr(:new, :(Pairs{eltype(I), eltype(A), I, A}), :data, :itr))
Pairs(data::A, itr::I) where {I, A} = $(Expr(:new, :(Pairs{I !== Nothing ? eltype(I) : keytype(A), eltype(A), I, A}), :data, :itr))
end
pairs(::Type{NamedTuple}) = Pairs{Symbol, V, NTuple{N, Symbol}, NamedTuple{names, T}} where {V, N, names, T<:NTuple{N, Any}}
pairs(::Type{NamedTuple}) = Pairs{Symbol, V, Nothing, NT} where {V, NT <: NamedTuple}

"""
Base.Pairs(values, keys) <: AbstractDict{eltype(keys), eltype(values)}
Expand Down
3 changes: 3 additions & 0 deletions base/idset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ IdSet{T}() constructs a set (see [`Set`](@ref)) using
In the example below, the values are all `isequal` so they get overwritten in the ordinary `Set`.
The `IdSet` compares by `===` and so preserves the 3 different values.

!!! compat "Julia 1.11"
Exported in Julia 1.11 and later.

# Examples
```jldoctest; filter = r"\\n\\s*(1|1\\.0|true)"
julia> Set(Any[true, 1, 1.0])
Expand Down
4 changes: 1 addition & 3 deletions base/invalidation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ function invalidate_code_for_globalref!(b::Core.Binding, invalidated_bpart::Core
latest_bpart = user_binding.partitions
latest_bpart.max_world == typemax(UInt) || continue
is_some_implicit(binding_kind(latest_bpart)) || continue
new_bpart = need_to_invalidate_export ?
ccall(:jl_maybe_reresolve_implicit, Any, (Any, Csize_t), user_binding, new_max_world) :
latest_bpart
new_bpart = ccall(:jl_maybe_reresolve_implicit, Any, (Any, Csize_t), user_binding, new_max_world)
if need_to_invalidate_code || new_bpart !== latest_bpart
push!(queued_bindings, (convert(Core.Binding, user_binding), latest_bpart, new_bpart))
end
Expand Down
20 changes: 10 additions & 10 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -267,48 +267,48 @@ pairs(::IndexLinear, A::AbstractArray) = Pairs(A, LinearIndices(A))
# preserve indexing capabilities for known indexable types
# faster than zip(keys(a), values(a)) for arrays
pairs(tuple::Tuple) = Pairs{Int}(tuple, keys(tuple))
pairs(nt::NamedTuple) = Pairs{Symbol}(nt, keys(nt))
pairs(nt::NamedTuple) = Pairs{Symbol}(nt, nothing)
pairs(v::Core.SimpleVector) = Pairs(v, LinearIndices(v))
pairs(A::AbstractVector) = pairs(IndexLinear(), A)
# pairs(v::Pairs) = v # listed for reference, but already defined from being an AbstractDict

pairs(::IndexCartesian, A::AbstractArray) = Pairs(A, Base.CartesianIndices(axes(A)))
pairs(A::AbstractArray) = pairs(IndexCartesian(), A)

length(v::Pairs) = length(getfield(v, :itr))
axes(v::Pairs) = axes(getfield(v, :itr))
size(v::Pairs) = size(getfield(v, :itr))
length(v::Pairs) = length(keys(v))
axes(v::Pairs) = axes(keys(v))
size(v::Pairs) = size(keys(v))

Base.@eval @propagate_inbounds function _pairs_elt(p::Pairs{K, V}, idx) where {K, V}
return $(Expr(:new, :(Pair{K, V}), :idx, :(getfield(p, :data)[idx])))
end

@propagate_inbounds function iterate(p::Pairs{K, V}, state...) where {K, V}
x = iterate(getfield(p, :itr), state...)
x = iterate(keys(p), state...)
x === nothing && return x
idx, next = x
return (_pairs_elt(p, idx), next)
end

@propagate_inbounds function iterate(r::Reverse{<:Pairs}, state=(reverse(getfield(r.itr, :itr)),))
@propagate_inbounds function iterate(r::Reverse{<:Pairs}, state=(reverse(keys(r.itr)),))
x = iterate(state...)
x === nothing && return x
idx, next = x
return (_pairs_elt(r.itr, idx), (state[1], next))
end

@inline isdone(v::Pairs, state...) = isdone(getfield(v, :itr), state...)
@inline isdone(v::Pairs, state...) = isdone(keys(v), state...)

IteratorSize(::Type{<:Pairs{<:Any, <:Any, I}}) where {I} = IteratorSize(I)
IteratorSize(::Type{<:Pairs{<:Any, <:Any, <:AbstractUnitRange, <:Tuple}}) = HasLength()

function last(v::Pairs{K, V}) where {K, V}
idx = last(getfield(v, :itr))
idx = last(keys(v))
return Pair{K, V}(idx, v[idx])
end

haskey(v::Pairs, key) = (key in getfield(v, :itr))
keys(v::Pairs) = getfield(v, :itr)
haskey(v::Pairs, key) = key in keys(v)
keys(v::Pairs) = getfield(v, :itr) === nothing ? keys(getfield(v, :data)) : getfield(v, :itr)
values(v::Pairs) = getfield(v, :data) # TODO: this should be a view of data subset by itr
getindex(v::Pairs, key) = getfield(v, :data)[key]
setindex!(v::Pairs, value, key) = (getfield(v, :data)[key] = value; v)
Expand Down
34 changes: 20 additions & 14 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1267,17 +1267,21 @@ function _include_from_serialized(pkg::PkgId, path::String, ocachepath::Union{No
sv = try
if ocachepath !== nothing
@debug "Loading object cache file $ocachepath for $(repr("text/plain", pkg))"
ccall(:jl_restore_package_image_from_file, Ref{SimpleVector}, (Cstring, Any, Cint, Cstring, Cint),
ccall(:jl_restore_package_image_from_file, Any, (Cstring, Any, Cint, Cstring, Cint),
ocachepath, depmods, #=completeinfo=#false, pkg.name, ignore_native)
else
@debug "Loading cache file $path for $(repr("text/plain", pkg))"
ccall(:jl_restore_incremental, Ref{SimpleVector}, (Cstring, Any, Cint, Cstring),
ccall(:jl_restore_incremental, Any, (Cstring, Any, Cint, Cstring),
path, depmods, #=completeinfo=#false, pkg.name)
end
finally
lock(require_lock)
end
if isa(sv, Exception)
return sv
end

sv = sv::SimpleVector
edges = sv[3]::Vector{Any}
ext_edges = sv[4]::Union{Nothing,Vector{Any}}
extext_methods = sv[5]::Vector{Any}
Expand Down Expand Up @@ -2630,21 +2634,23 @@ function __require_prelocked(pkg::PkgId, env)
@goto load_from_cache
end
# spawn off a new incremental pre-compile task for recursive `require` calls
loaded = maybe_cachefile_lock(pkg, path) do
# double-check the search now that we have lock
m = _require_search_from_serialized(pkg, path, UInt128(0), true)
m isa Module && return m
triggers = get(EXT_PRIMED, pkg, nothing)
loadable_exts = nothing
if triggers !== nothing # extension
loadable_exts = PkgId[]
for (ext′, triggers′) in EXT_PRIMED
if triggers′ ⊊ triggers
push!(loadable_exts, ext′)
loaded = let path = path, reasons = reasons
maybe_cachefile_lock(pkg, path) do
# double-check the search now that we have lock
m = _require_search_from_serialized(pkg, path, UInt128(0), true)
m isa Module && return m
triggers = get(EXT_PRIMED, pkg, nothing)
loadable_exts = nothing
if triggers !== nothing # extension
loadable_exts = PkgId[]
for (ext′, triggers′) in EXT_PRIMED
if triggers′ ⊊ triggers
push!(loadable_exts, ext′)
end
end
end
return compilecache(pkg, path; reasons, loadable_exts)
end
return compilecache(pkg, path; reasons, loadable_exts)
end
loaded isa Module && return loaded
if isnothing(loaded) # maybe_cachefile_lock returns nothing if it had to wait for another process
Expand Down
6 changes: 3 additions & 3 deletions base/namedtuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ merge(a::NamedTuple, b::NamedTuple{()}) = a
merge(a::NamedTuple{()}, b::NamedTuple{()}) = a
merge(a::NamedTuple{()}, b::NamedTuple) = b

merge(a::NamedTuple, b::Iterators.Pairs{<:Any,<:Any,<:Any,<:NamedTuple}) = merge(a, getfield(b, :data))
merge(a::NamedTuple, b::Iterators.Pairs{<:Any,<:Any,Nothing,<:NamedTuple}) = merge(a, getfield(b, :data))

merge(a::NamedTuple, b::Iterators.Zip{<:Tuple{Any,Any}}) = merge(a, NamedTuple{Tuple(b.is[1])}(b.is[2]))

Expand Down Expand Up @@ -535,7 +535,7 @@ when it is printed in the stack trace view.

```julia
julia> @Kwargs{init::Int} # the internal representation of keyword arguments
Base.Pairs{Symbol, Int64, Tuple{Symbol}, @NamedTuple{init::Int64}}
Base.Pairs{Symbol, Int64, Nothing, @NamedTuple{init::Int64}}

julia> sum("julia"; init=1)
ERROR: MethodError: no method matching +(::Char, ::Char)
Expand Down Expand Up @@ -578,7 +578,7 @@ Stacktrace:
macro Kwargs(ex)
return :(let
NT = @NamedTuple $ex
Base.Pairs{keytype(NT),eltype(NT),typeof(NT.parameters[1]),NT}
Base.Pairs{keytype(NT),eltype(NT),Nothing,NT}
end)
end

Expand Down
6 changes: 4 additions & 2 deletions base/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,8 @@ function show_type_name(io::IO, tn::Core.TypeName)
end

function maybe_kws_nt(x::DataType)
# manually-written version of
# x <: (Pairs{Symbol, eltype(NT), Nothing, NT} where NT <: NamedTuple)
x.name === typename(Pairs) || return nothing
length(x.parameters) == 4 || return nothing
x.parameters[1] === Symbol || return nothing
Expand All @@ -1115,7 +1117,7 @@ function maybe_kws_nt(x::DataType)
types isa DataType || return nothing
x.parameters[2] === eltype(p4) || return nothing
isa(syms, Tuple) || return nothing
x.parameters[3] === typeof(syms) || return nothing
x.parameters[3] === Nothing || return nothing
return p4
end
return nothing
Expand Down Expand Up @@ -3313,7 +3315,7 @@ function Base.showarg(io::IO, r::Iterators.Pairs{<:Integer, <:Any, <:Any, T}, to
print(io, "pairs(IndexLinear(), ::", T, ")")
end

function Base.showarg(io::IO, r::Iterators.Pairs{Symbol, <:Any, <:Any, T}, toplevel) where {T <: NamedTuple}
function Base.showarg(io::IO, r::Iterators.Pairs{Symbol, <:Any, Nothing, T}, toplevel) where {T <: NamedTuple}
print(io, "pairs(::NamedTuple)")
end

Expand Down
2 changes: 1 addition & 1 deletion base/stacktraces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,4 @@ function from(frame::StackFrame, m::Module)
return parentmodule(frame) === m
end

end
end # module StackTraces
4 changes: 2 additions & 2 deletions base/strings/string.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ An error occurred when trying to access `str` at index `i` that is not valid.
"""
struct StringIndexError <: Exception
string::AbstractString
index::Integer
index::Int
end
@noinline string_index_err(s::AbstractString, i::Integer) =
@noinline string_index_err((@nospecialize s::AbstractString), i::Integer) =
throw(StringIndexError(s, Int(i)))
function Base.showerror(io::IO, exc::StringIndexError)
s = exc.string
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f41f7e4247fddb5531dea530bee83024
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d2596e62f75841be0da013c8c41708577ae2527d3564d95081385d77fc00da514a46f25bbb42304b76127890018358cb191c80c18ba57818c2fde8ebedde260b
Loading
Loading