Skip to content

Commit 87a07e7

Browse files
authored
Bonus backports to 1.12.1 (#59862)
2 parents ecee0f7 + be35825 commit 87a07e7

File tree

5 files changed

+84
-16
lines changed

5 files changed

+84
-16
lines changed

stdlib/Markdown/src/Julia/interp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ toexpr(x) = x
4646
toexpr(xs::Union{Vector{Any},Vector{Vector{Any}}}) =
4747
Expr(:call, GlobalRef(Base,:getindex), Any, mapany(toexpr, xs)...)
4848

49-
for T in Any[MD, Paragraph, Header, Link, Bold, Italic]
49+
for T in Any[MD, Paragraph, Header, Link, Bold, Italic, Footnote, Admonition]
5050
@eval function toexpr(md::$T)
5151
Expr(:call, typeof(md), $(map(x->:(toexpr(md.$x)), fieldnames(Base.unwrap_unionall(T)))...))
5252
end

stdlib/Markdown/test/runtests.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,30 @@ sum_ref = md"Behaves like $(ref(sum))"
502502
@test plain(sum_ref) == "Behaves like sum (see Julia docs)\n"
503503
@test html(sum_ref) == "<p>Behaves like sum &#40;see Julia docs&#41;</p>\n"
504504

505+
# JuliaLang/julia#59783
506+
let x = 1,
507+
result = md"""
508+
$x
509+
510+
[^1]: $x
511+
512+
!!! note
513+
$x
514+
""",
515+
expected = """
516+
1
517+
518+
[^1]: 1
519+
520+
!!! note
521+
522+
523+
524+
1
525+
"""
526+
@test plain(result) == expected
527+
end
528+
505529
show(io::IO, m::MIME"text/html", r::Reference) =
506530
Markdown.withtag(io, :a, :href=>"test") do
507531
Markdown.htmlesc(io, Markdown.plaininline(r))

stdlib/REPL/src/REPLCompletions.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,6 @@ function complete_keyword_argument!(suggestions::Vector{Completion},
905905
kwargs_flag == 2 && return false # one of the previous kwargs is invalid
906906

907907
methods = Completion[]
908-
# Limit kwarg completions to cases when function is concretely known; looking up
909-
# matching methods for abstract functions — particularly `Any` or `Function` — can
910-
# take many seconds to run over the thousands of possible methods. Note that
911-
# isabstracttype would return naively return true for common constructor calls
912-
# like Array, but the REPL's introspection here may know their Type{T}.
913-
isconcretetype(funct) || return false
914908
complete_methods!(methods, funct, Any[Vararg{Any}], kwargs_ex, -1, arg_pos == :kwargs)
915909
# TODO: use args_ex instead of Any[Vararg{Any}] and only provide kwarg completion for
916910
# method calls compatible with the current arguments.

stdlib/REPL/src/precompile.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,17 @@ end
191191

192192
let
193193
if Base.generating_output() && Base.JLOptions().use_pkgimages != 0
194-
repl_workload()
195-
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Any, Int})
196-
precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, String})
197-
precompile(Tuple{typeof(Base.:(==)), Char, String})
198-
#for child in copy(Base.newly_inferred)
199-
# precompile((child::Base.CodeInstance).def)
200-
#end
194+
# Bare-bones PrecompileTools.jl
195+
# Do we need latestworld-if-toplevel here
196+
ccall(:jl_tag_newly_inferred_enable, Cvoid, ())
197+
try
198+
repl_workload()
199+
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Any, Any}, Any, Int})
200+
precompile(Tuple{typeof(Base.delete!), Base.Set{Any}, String})
201+
precompile(Tuple{typeof(Base.:(==)), Char, String})
202+
finally
203+
ccall(:jl_tag_newly_inferred_disable, Cvoid, ())
204+
end
201205
end
202206
end
203207

stdlib/REPL/test/replcompletions.jl

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2687,8 +2687,54 @@ f54131 = F54131()
26872687

26882688
s = "f54131.x(kwa"
26892689
a, b, c = completions(s, lastindex(s), @__MODULE__, false)
2690-
@test_broken REPLCompletions.KeywordArgumentCompletion("kwarg") in a
2691-
@test (@elapsed completions(s, lastindex(s), @__MODULE__, false)) < 1
2690+
@test REPLCompletions.KeywordArgumentCompletion("kwarg") in a
2691+
@test (@elapsed completions(s, lastindex(s), @__MODULE__, false)) < 100
2692+
end
2693+
2694+
@kwdef struct T59244
2695+
asdf = 1
2696+
qwer = 2
2697+
end
2698+
@kwdef struct S59244{T}
2699+
asdf::T = 1
2700+
qwer::T = 2
2701+
end
2702+
@testset "kwarg completion of types" begin
2703+
s = "T59244(as"
2704+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2705+
@test REPLCompletions.KeywordArgumentCompletion("asdf") in a
2706+
2707+
s = "T59244(; qw"
2708+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2709+
@test REPLCompletions.KeywordArgumentCompletion("qwer") in a
2710+
@test REPLCompletions.KeywordArgumentCompletion("qwer") == only(a)
2711+
2712+
s = "S59244(as"
2713+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2714+
@test REPLCompletions.KeywordArgumentCompletion("asdf") in a
2715+
2716+
s = "S59244(; qw"
2717+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2718+
@test REPLCompletions.KeywordArgumentCompletion("qwer") in a
2719+
@test REPLCompletions.KeywordArgumentCompletion("qwer") == only(a)
2720+
2721+
s = "S59244{Int}(as"
2722+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2723+
@test REPLCompletions.KeywordArgumentCompletion("asdf") in a
2724+
2725+
s = "S59244{Int}(; qw"
2726+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2727+
@test REPLCompletions.KeywordArgumentCompletion("qwer") in a
2728+
@test REPLCompletions.KeywordArgumentCompletion("qwer") == only(a)
2729+
2730+
s = "S59244{Any}(as"
2731+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2732+
@test REPLCompletions.KeywordArgumentCompletion("asdf") in a
2733+
2734+
s = "S59244{Any}(; qw"
2735+
a, b, c = completions(s, lastindex(s), @__MODULE__, #= shift =# false)
2736+
@test REPLCompletions.KeywordArgumentCompletion("qwer") in a
2737+
@test REPLCompletions.KeywordArgumentCompletion("qwer") == only(a)
26922738
end
26932739

26942740
# Completion inside string interpolation

0 commit comments

Comments
 (0)