Skip to content

Commit

Permalink
fix showing methods with unicode gensymed variable names (JuliaLang#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC authored and simeonschaub committed Aug 11, 2020
1 parent 5374ad6 commit c14693e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/methodshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function argtype_decl(env, n, sig::DataType, i::Int, nargs, isva::Bool) # -> (ar
s = string(n)
i = findfirst(isequal('#'), s)
if i !== nothing
s = s[1:i-1]
s = s[1:prevind(s, i)]
end
if t === Any && !isempty(s)
return s, ""
Expand Down
9 changes: 9 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1985,3 +1985,12 @@ end
@test sprint(show, skipmissing([1,2,missing])) == "skipmissing(Union{Missing, $Int}[1, 2, missing])"
@test sprint(show, skipmissing((missing,1.0,'a'))) == "skipmissing((missing, 1.0, 'a'))"
end

@testset "unicode in method table" begin
αsym = gensym()
ℓsym = gensym(:ℓ)
eval(:(foo($αsym) = $αsym))
eval(:(bar($ℓsym) = $ℓsym))
@test contains(string(methods(foo)), "foo(α)")
@test contains(string(methods(bar)), "bar(ℓ)")
end

0 comments on commit c14693e

Please sign in to comment.