Skip to content

Commit

Permalink
Merge branch 'master' into BumpStdlibs/Statistics-d49c2bf-master
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored Dec 15, 2024
2 parents 3a1f8fe + 006f19c commit e851a15
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 8 deletions.
12 changes: 9 additions & 3 deletions base/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ using .Base:
AbstractRange, AbstractUnitRange, UnitRange, LinearIndices, TupleOrBottom,
(:), |, +, -, *, !==, !, ==, !=, <=, <, >, >=, =>, missing,
any, _counttuple, eachindex, ntuple, zero, prod, reduce, in, firstindex, lastindex,
tail, fieldtypes, min, max, minimum, zero, oneunit, promote, promote_shape, LazyString
tail, fieldtypes, min, max, minimum, zero, oneunit, promote, promote_shape, LazyString,
afoldl
using Core: @doc

using .Base:
Expand Down Expand Up @@ -1202,8 +1203,13 @@ julia> [(x,y) for x in 0:1 for y in 'a':'c'] # collects generators involving It
flatten(itr) = Flatten(itr)

eltype(::Type{Flatten{I}}) where {I} = eltype(eltype(I))
eltype(::Type{Flatten{I}}) where {I<:Union{Tuple,NamedTuple}} = promote_typejoin(map(eltype, fieldtypes(I))...)
eltype(::Type{Flatten{Tuple{}}}) = eltype(Tuple{})

# For tuples, we statically know the element type of each index, so we can compute
# this at compile time.
function eltype(::Type{Flatten{I}}) where {I<:Union{Tuple,NamedTuple}}
afoldl((T, i) -> promote_typejoin(T, eltype(i)), Union{}, fieldtypes(I)...)
end

IteratorEltype(::Type{Flatten{I}}) where {I} = _flatteneltype(I, IteratorEltype(I))
IteratorEltype(::Type{Flatten{Tuple{}}}) = IteratorEltype(Tuple{})
_flatteneltype(I, ::HasEltype) = IteratorEltype(eltype(I))
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
308e26cc6171656caaa7f6ba07e83d1c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
62b94ad0dca0d62e5753f50aef806ebdb5c8b56b241a285957190845be21fc6b8c8f93089b6f627795f6d7f2b1b01118bcff87c21102a3f3bae6d4c408362681
2 changes: 1 addition & 1 deletion stdlib/SparseArrays.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SPARSEARRAYS_BRANCH = main
SPARSEARRAYS_SHA1 = 1b4933ccc7b1f97427ff88bd7ba58950021f2c60
SPARSEARRAYS_SHA1 = 4fd3aad5735e3b80eefe7b068f3407d7dd0c0924
SPARSEARRAYS_GIT_URL := https://github.com/JuliaSparse/SparseArrays.jl.git
SPARSEARRAYS_TAR_URL = https://api.github.com/repos/JuliaSparse/SparseArrays.jl/tarball/$1
18 changes: 16 additions & 2 deletions test/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,22 @@ backtrace()
@test occursin("g28442", output[3])
@test lstrip(output[5])[1:3] == "[2]"
@test occursin("f28442", output[5])
@test occursin("the above 2 lines are repeated 5000 more times", output[7])
@test lstrip(output[8])[1:7] == "[10003]"
is_windows_32_bit = Sys.iswindows() && (Sys.WORD_SIZE == 32)
if is_windows_32_bit
# These tests are currently broken (intermittently/non-determistically) on 32-bit Windows.
# https://github.com/JuliaLang/julia/issues/55900
# Instead of skipping them entirely, we skip one, and we loosen the other.

# Broken test: @test occursin("the above 2 lines are repeated 5000 more times", output[7])
@test occursin("the above 2 lines are repeated ", output[7])
@test occursin(" more times", output[7])

# Broken test: @test lstrip(output[8])[1:7] == "[10003]"
@test_broken false
else
@test occursin("the above 2 lines are repeated 5000 more times", output[7])
@test lstrip(output[8])[1:7] == "[10003]"
end
end

@testset "Line number correction" begin
Expand Down
8 changes: 8 additions & 0 deletions test/iterators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,14 @@ end
@test eltype(flatten(UnitRange{Int8}[1:2, 3:4])) == Int8
@test eltype(flatten(([1, 2], [3.0, 4.0]))) == Real
@test eltype(flatten((a = [1, 2], b = Int8[3, 4]))) == Signed
@test eltype(flatten((Int[], Nothing[], Int[]))) == Union{Int, Nothing}
@test eltype(flatten((String[],))) == String
@test eltype(flatten((Int[], UInt[], Int8[],))) == Integer
@test eltype(flatten((; a = Int[], b = Nothing[], c = Int[]))) == Union{Int, Nothing}
@test eltype(flatten((; a = String[],))) == String
@test eltype(flatten((; a = Int[], b = UInt[], c = Int8[],))) == Integer
@test eltype(flatten(())) == Union{}
@test eltype(flatten((;))) == Union{}
@test length(flatten(zip(1:3, 4:6))) == 6
@test length(flatten(1:6)) == 6
@test collect(flatten(Any[])) == Any[]
Expand Down
2 changes: 2 additions & 0 deletions test/sets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,8 @@ end
@test !isempty(A)
A = empty!(A)
@test isempty(A)
@test isnothing(sizehint!(A, 10))
@test Base.copymutable(A) == copy(A)
end

@testset "⊊, ⊋" begin
Expand Down

0 comments on commit e851a15

Please sign in to comment.