-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
add back wordaround for Slot objects should not occur in an AST
in Ipython mode
#47878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
let __temp_val_a72df459 = $x | ||
$capture_result($n, __temp_val_a72df459) | ||
__temp_val_a72df459 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, I had toyed with making capture_result
return the value too, so that it could be written as:
let __temp_val_a72df459 = $x | |
$capture_result($n, __temp_val_a72df459) | |
__temp_val_a72df459 | |
end | |
$capture_result($n, $x) |
d7aef6f
to
7574e02
Compare
@vtjnash, any idea how this could have broken the REPL completion tests? If I comment out the new tests, they pass... |
Strange. Those seem like they should be isolated |
So what happens is that in the new test I define: x = range(-1; stop = 1) which makes "CompletionFoo.kwtest4(x23=18, x; " which ends up in julia/stdlib/REPL/src/REPLCompletions.jl Line 638 in 0fbe56e
where the type of julia> REPLCompletions.get_type(:(x), Main)
(UnitRange{Int64}, true)
# (Any, false) if test is not run and then we get: julia> t_in = Tuple{typeof(Main.CompletionFoo.kwtest4), UnitRange{Int64}};
julia> max_method_completions = -2;
julia> Base._methods_by_ftype(t_in, nothing, max_method_completions, Base.get_world_counter(),
#=ambig=# true, Ref(typemin(UInt)), Ref(typemax(UInt)), Ptr{Int32}(C_NULL))
Any[] instead of (if the test is not run and julia> t_in = Tuple{typeof(Main.CompletionFoo.kwtest4), Any};
julia> max_method_completions = -2;
julia> Base._methods_by_ftype(t_in, nothing, max_method_completions, Base.get_world_counter(),
#=ambig=# true, Ref(typemin(UInt)), Ref(typemax(UInt)), Ptr{Int32}(C_NULL))
3-element Vector{Any}:
Core.MethodMatch(Tuple{typeof(Main.CompletionFoo.kwtest4), SubString}, svec(), kwtest4(a::SubString; x23, _something) @ Main.CompletionFoo ~/julia/stdlib/REPL/test/replcompletions.jl:113, false)
Core.MethodMatch(Tuple{typeof(Main.CompletionFoo.kwtest4), String}, svec(), kwtest4(a::String; _a1b, xαβγ) @ Main.CompletionFoo ~/julia/stdlib/REPL/test/replcompletions.jl:112, false)
Core.MethodMatch(Tuple{typeof(Main.CompletionFoo.kwtest4), AbstractString}, svec(), kwtest4(a::AbstractString; _a1b, x23) @ Main.CompletionFoo ~/julia/stdlib/REPL/test/replcompletions.jl:111, false) We can replicate this in the REPL: julia> begin
kwtest4(a::AbstractString; _a1b, x23) = pass
kwtest4(a::String; _a1b, xαβγ) = pass
kwtest4(a::SubString; x23, _something) = pass
end
kwtest5 (generic function with 1 method)
julia> kwtest4(x23=18, x; <TAB>
kwtest4(a::SubString; x23, _something) @ Main REPL[1]:4
kwtest4(a::String; _a1b, xαβγ) @ Main REPL[1]:3
kwtest4(a::AbstractString; _a1b, x23) @ Main REPL[1]:2
julia> x = 3
3
julia> kwtest4(x23=18, x; <TAB> where the last tab complete no longer works. So the "solution" to fix the test here is to use another variable name than cc @Liozou who I think implemented the keyword completion stuff. |
Ah, that is right. |
Apologies for having made you track such an ugly test issue! I should not have used a simple The REPL completion behavior may be slightly convoluted but it is indeed valid:
The solution is indeed to rename the -let s = "CompletionFoo.kwtest4(x23=18, x; "
+let s = "CompletionFoo.kwtest4(x23=18, undefined43536; "
c, r, res = test_complete(s)
@test !res
@test length(c) == 3 # TODO: remove "kwtest4(a::String; _a1b, xαβγ)"
@test any(str->occursin("kwtest4(a::SubString", str), c)
@test any(str->occursin("kwtest4(a::AbstractString", str), c)
- @test (c, r, res) == test_complete("CompletionFoo.kwtest4(x23=18, x, ")
+ @test (c, r, res) == test_complete("CompletionFoo.kwtest4(x23=18, undefined43536, ")
@test (c, r, res) == test_complete("CompletionFoo.kwtest4(x23=18, ")
end There is another test further down which might possibly be affected by having an julia/stdlib/REPL/test/replcompletions.jl Line 1609 in 0fcf896
|
This workaround was removed in #47178 (cc @vtjnash).
Ref #46451
On master: