Skip to content

Commit

Permalink
1.10: REPL: fix intermittent REPL test failure (#53096)
Browse files Browse the repository at this point in the history
The earlier test relied on the order of the method match list returned
by `_methods_by_ftype`. However, particularly in cases where the
`ambig=true` option is used, the match list isn't deterministic. This
commit modifies it, similar to other pieces of code, so that it `any` to
ensure the code does not depend on the implementation details of
`ml_matches`.

Fixes #52739.
  • Loading branch information
aviatesk authored Jan 29, 2024
1 parent ece8b7b commit 2c8ecd3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions stdlib/REPL/test/replcompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ let s = "CompletionFoo.?([1,2,3], 2.0)"
c, r, res = test_complete(s)
@test !res
@test length(c) == 1
@test occursin("test(x::AbstractArray{T}, y) where T<:Real", c[1])
@test occursin("test(x::AbstractArray{T}, y) where T<:Real", only(c))
# In particular, this checks that test(args...) is not a valid completion
# since it is strictly less specific than test(x::AbstractArray{T}, y)
end
Expand Down Expand Up @@ -680,15 +680,15 @@ let s = "CompletionFoo.?(false, \"a\", 3, "
c, r, res = test_complete(s)
@test !res
@test length(c) == 2
@test occursin("test(args...)", c[1])
@test occursin("test11(a::Integer, b, c)", c[2])
@test any(s->occursin("test(args...)", s), c)
@test any(s->occursin("test11(a::Integer, b, c)", s), c)
end

let s = "CompletionFoo.?(false, \"a\", 3, "
c, r, res = test_complete_noshift(s)
@test !res
@test length(c) == 1
@test occursin("test11(a::Integer, b, c)", c[1])
@test occursin("test11(a::Integer, b, c)", only(c))
end

let s = "CompletionFoo.?(\"a\", 3, "
Expand All @@ -711,7 +711,7 @@ let s = "CompletionFoo.?()"
c, r, res = test_complete_noshift(s)
@test !res
@test length(c) == 1
@test occursin("test10(s::String...)", c[1])
@test occursin("test10(s::String...)", only(c))
end

#= TODO: restrict the number of completions when a semicolon is present in ".?(" syntax
Expand Down

0 comments on commit 2c8ecd3

Please sign in to comment.