diff --git a/base/set.jl b/base/set.jl index 2f96cef626b6f..d1f9458039cd4 100644 --- a/base/set.jl +++ b/base/set.jl @@ -549,8 +549,8 @@ function allunique(A::StridedArray) if length(A) < 32 _indexed_allunique(A) elseif OrderStyle(eltype(A)) === Ordered() - a1, rest1 = Iterators.peel(A) - a2, rest = Iterators.peel(rest1) + a1, rest1 = Iterators.peel(A)::Tuple{Any,Any} + a2, rest = Iterators.peel(rest1)::Tuple{Any,Any} if !isequal(a1, a2) compare = isless(a1, a2) ? isless : (a,b) -> isless(b,a) for a in rest diff --git a/test/sets.jl b/test/sets.jl index 4ab360c9fedd4..b78d2f15dd989 100644 --- a/test/sets.jl +++ b/test/sets.jl @@ -644,6 +644,7 @@ end @test !allunique((NaN, NaN)) # Known length 1, need not evaluate: @test allunique(error(x) for x in [1]) + # @test_opt allunique(Int[]) end @testset "allunique(f, xs)" begin