@@ -2301,3 +2301,32 @@ let s = "Issue53126()."
23012301 @test res
23022302 @test isempty (c)
23032303end
2304+
2305+ function g54131 end
2306+ for i in 1 : 498
2307+ @eval g54131 (:: Val{$i} ) = i
2308+ end
2309+ g54131 (:: Val{499} ; kwarg= true ) = 499 * kwarg
2310+ struct F54131; end
2311+ Base. getproperty (:: F54131 , :: Symbol ) = Any[cos, sin, g54131][rand (1 : 3 )]
2312+ f54131 = F54131 ()
2313+ @testset " performance of kwarg completion with large method tables" begin
2314+ # The goal here is to simply ensure we aren't hitting catestrophically bad
2315+ # behaviors when shift isn't pressed. The difference between good and bad
2316+ # is on the order of tens of milliseconds vs tens of seconds; using 1 sec as
2317+ # a very rough canary that is hopefully robust even in the noisy CI coalmines
2318+ s = " g54131(kwa"
2319+ a, b, c = completions (s, lastindex (s), @__MODULE__ , #= shift =# false )
2320+ @test REPLCompletions. KeywordArgumentCompletion (" kwarg" ) in a
2321+ @test (@elapsed completions (s, lastindex (s), @__MODULE__ , false )) < 1
2322+
2323+ s = " f54131.x("
2324+ a, b, c = completions (s, lastindex (s), @__MODULE__ , false )
2325+ @test only (a) isa REPLCompletions. TextCompletion
2326+ @test (@elapsed completions (s, lastindex (s), @__MODULE__ , false )) < 1
2327+
2328+ s = " f54131.x(kwa"
2329+ a, b, c = completions (s, lastindex (s), @__MODULE__ , false )
2330+ @test_broken REPLCompletions. KeywordArgumentCompletion (" kwarg" ) in a
2331+ @test (@elapsed completions (s, lastindex (s), @__MODULE__ , false )) < 1
2332+ end
0 commit comments