Skip to content

Commit

Permalink
test: restore ambiguous test
Browse files Browse the repository at this point in the history
Unfortunately, this test has become broken in the interim since it was
disabled by 176ef64 / a15fe4b.
  • Loading branch information
vtjnash committed Aug 21, 2023
1 parent 68afc6e commit e2c78b8
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions test/ambiguous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,29 @@ using Test, LinearAlgebra, SparseArrays, Aqua
end
end

@testset "detect_ambiguities" begin
@test_nowarn detect_ambiguities(SparseArrays; recursive=true, ambiguous_bottom=false)
let ambig = detect_ambiguities(SparseArrays; recursive=true)
@test_broken isempty(ambig)
ambig = Set{Any}(((m1.sig, m2.sig) for (m1, m2) in ambig))
expect = []
push!(expect, (Tuple{typeof(LinearAlgebra.generic_trimatmul!), AbstractVecOrMat, Any, Any, Function, AbstractMatrix, AbstractVecOrMat},
Tuple{typeof(LinearAlgebra.generic_trimatmul!), StridedVecOrMat, Any, Any, Any, Union{Adjoint{var"#s388", var"#s387"}, Transpose{var"#s388", var"#s387"}} where {var"#s388", var"#s387"<:(Union{SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, SubArray{Tv, 2, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int}}, I}} where I<:AbstractUnitRange} where {Tv, Ti})}, AbstractVecOrMat}))
push!(expect, (Tuple{typeof(LinearAlgebra.generic_trimatmul!), AbstractVecOrMat, Any, Any, Function, Union{Adjoint{T, S}, Transpose{T, S}} where {T, S}, AbstractVecOrMat},
Tuple{typeof(LinearAlgebra.generic_trimatmul!), StridedVecOrMat, Any, Any, Any, Union{Adjoint{var"#s388", var"#s387"}, Transpose{var"#s388", var"#s387"}} where {var"#s388", var"#s387"<:(Union{SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, SubArray{Tv, 2, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int}}, I}} where I<:AbstractUnitRange} where {Tv, Ti})}, AbstractVecOrMat}))
good = true
while !isempty(ambig)
sigs = pop!(ambig)
i = findfirst(==(sigs), expect)
if i === nothing
println(stderr, "push!(expect, (", sigs[1], ", ", sigs[2], "))")
good = false
continue
end
deleteat!(expect, i)
end
@test isempty(expect)
@test good
end

## This was the older version that was disabled

# let ambig = detect_ambiguities(SparseArrays; recursive=true)
# @test isempty(ambig)
# ambig = Set{Any}(((m1.sig, m2.sig) for (m1, m2) in ambig))
# expect = []
# good = true
# while !isempty(ambig)
# sigs = pop!(ambig)
# i = findfirst(==(sigs), expect)
# if i === nothing
# println(stderr, "push!(expect, (", sigs[1], ", ", sigs[2], "))")
# good = false
# continue
# end
# deleteat!(expect, i)
# end
# @test isempty(expect)
# @test good
# end

###
# Now we restore the original env, as promised
empty!(Base.DEPOT_PATH)
Expand Down

0 comments on commit e2c78b8

Please sign in to comment.