Skip to content
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

help? mode: Error showing value of type Markdown.MD #57402

Closed
mbauman opened this issue Feb 13, 2025 · 5 comments · Fixed by #57526
Closed

help? mode: Error showing value of type Markdown.MD #57402

mbauman opened this issue Feb 13, 2025 · 5 comments · Fixed by #57526
Assignees
Labels
docsystem The documentation building system regression Regression in behavior compared to a previous version REPL Julia's REPL (Read Eval Print Loop)
Milestone

Comments

@mbauman
Copy link
Member

mbauman commented Feb 13, 2025

On today's nightly:

help?> round
search: round rounding count rand run RoundUp count!

  round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]])
  round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]]; digits=0, base=10)
  round(z::Complex[, RoundingModeReal, [RoundingModeImaginary]]; sigdigits, base=10)

  Return the nearest integral value of the same type as the complex-valued z
  to z, breaking ties using the specified RoundingModes. The first
  RoundingMode is used for rounding the real components while the second is
  used for rounding the imaginary components.

  RoundingModeReal and RoundingModeImaginary default to RoundNearest, which
  rounds to the nearest integer, with ties (fractional values of 0.5) being
  rounded to the nearest even integer.

  Examples
  ≡≡≡≡≡≡≡≡

  julia> round(3.14 + 4.5im)
  3.0 + 4.0im

  julia> round(3.14 + 4.5im, RoundUp, RoundNearestTiesUp)
  4.0 + 5.0im

  julia> round(3.14159 + 4.512im; digits = 1)
  3.1 + 4.5im

  julia> round(3.14159 + 4.512im; sigdigits = 3)
  3.14 + 4.51im

  ────────────────────────────────────────────────────────────────────────────

Error showing value of type Markdown.MD:
ERROR: MethodError: no method matching keys(::Nothing)
The function `keys` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  keys(::Cmd)
   @ Base process.jl:716
  keys(::Core.SimpleVector)
   @ Base essentials.jl:945
  keys(::Base.TermInfo)
   @ Base terminfo.jl:232
  ...

Stacktrace:
  [1] pairs(collection::Nothing)
    @ Base ./abstractdict.jl:178
  [2] findfirst(testf::JuliaSyntaxHighlighting.var"#17#18", A::Nothing)
    @ Base ./array.jl:2433
  [3] _hl_annotations!(highlights::Vector{…}, lineage::JuliaSyntaxHighlighting.GreenLineage, ctx::JuliaSyntaxHighlighting.HighlightContext{…}; syntax_errors::Bool)
    @ JuliaSyntaxHighlighting ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:222
  [4] _hl_annotations!
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:181 [inlined]
  [5] _hl_annotations!(highlights::Vector{…}, lineage::JuliaSyntaxHighlighting.GreenLineage, ctx::JuliaSyntaxHighlighting.HighlightContext{…}; syntax_errors::Bool)
    @ JuliaSyntaxHighlighting ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:343
  [6] _hl_annotations!
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:181 [inlined]
  [7] _hl_annotations!(highlights::Vector{…}, lineage::JuliaSyntaxHighlighting.GreenLineage, ctx::JuliaSyntaxHighlighting.HighlightContext{…}; syntax_errors::Bool)
    @ JuliaSyntaxHighlighting ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:343
  [8] _hl_annotations!
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:181 [inlined]
  [9] _hl_annotations!(highlights::Vector{…}, lineage::JuliaSyntaxHighlighting.GreenLineage, ctx::JuliaSyntaxHighlighting.HighlightContext{…}; syntax_errors::Bool)
    @ JuliaSyntaxHighlighting ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:343
 [10] _hl_annotations!
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:181 [inlined]
 [11] #_hl_annotations#10
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:170 [inlined]
 [12] _hl_annotations
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:167 [inlined]
 [13] highlight
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:392 [inlined]
 [14] highlight
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/JuliaSyntaxHighlighting/src/JuliaSyntaxHighlighting.jl:383 [inlined]
 [15] term(io::IOContext{REPL.LimitIO{Base.TTY}}, md::Markdown.Code, columns::Int64)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:120
 [16] term(io::IOContext{REPL.LimitIO{Base.TTY}}, content::Vector{Any}, cols::Int64)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:10
 [17] term(io::IOContext{REPL.LimitIO{Base.TTY}}, md::Markdown.MD, columns::Int64)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:18
 [18] term(io::IOContext{REPL.LimitIO{Base.TTY}}, content::Vector{Any}, cols::Int64)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:13
 [19] term(io::IOContext{REPL.LimitIO{Base.TTY}}, md::Markdown.MD, columns::Int64)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:18
 [20] term(io::IOContext{REPL.LimitIO{Base.TTY}}, content::Vector{Any}, cols::Int64)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:13
 [21] term
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:18 [inlined]
 [22] term
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:17 [inlined]
 [23] show(io::IOContext{REPL.LimitIO{Base.TTY}}, ::MIME{Symbol("text/plain")}, md::Markdown.MD)
    @ Markdown ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/Markdown/src/render/terminal/render.jl:231
 [24] show_repl(io::IO, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:574
 [25] show_limited(io::IO, mime::MIME, x::Any)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:543
 [26] (::REPL.var"#display##0#display##1"{REPL.REPLDisplay{…}, MIME{…}, Base.RefValue{…}})(io::Any)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:566
 [27] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:867
 [28] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:552
 [29] display
    @ ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:572 [inlined]
 [30] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [31] #invokelatest#1
    @ ./essentials.jl:1057 [inlined]
 [32] invokelatest
    @ ./essentials.jl:1053 [inlined]
 [33] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:0
 [34] (::REPL.var"#print_response##0#print_response##1"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:584
 [35] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:867
 [36] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:582
 [37] (::REPL.var"#do_respond#71"{…})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:1209
 [38] #invokelatest#1
    @ ./essentials.jl:1057 [inlined]
 [39] invokelatest
    @ ./essentials.jl:1053 [inlined]
 [40] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/LineEdit.jl:2852
 [41] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:1680
 [42] (::REPL.var"#59#60"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/.julia/juliaup/julia-nightly/share/julia/stdlib/v1.13/REPL/src/REPL.jl:686
Some type information was truncated. Use `show(err)` to see complete types.

julia> versioninfo()
Julia Version 1.13.0-DEV.52
Commit 6b39a818bdc (2025-02-13 17:11 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m1)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 6 virtual cores)
@mbauman mbauman added the docsystem The documentation building system label Feb 13, 2025
@KristofferC KristofferC added this to the 1.12 milestone Feb 14, 2025
@tecosaur
Copy link
Contributor

I suspect this will be fixed after JuliaLang/JuliaSyntaxHighlighting.jl#9 is merged and the stdlib bumped.

@tecosaur tecosaur added REPL Julia's REPL (Read Eval Print Loop) regression Regression in behavior compared to a previous version labels Feb 24, 2025
@tecosaur tecosaur marked this as a duplicate of #57514 Feb 24, 2025
@tecosaur
Copy link
Contributor

Said PR has been merged, now the stdlib just needs to be bumped.

@mbauman
Copy link
Member Author

mbauman commented Feb 27, 2025

@tecosaur are there regression tests for this behavior either here or in JuliaSyntaxHighlighting? I didn't see it immediately, but it would be very good to have.

@tecosaur
Copy link
Contributor

tecosaur are there regression tests for this behavior either here or in JuliaSyntaxHighlighting? I didn't see it immediately, but it would be very good to have.

This is something that I've thought of, but it's a little tricky. While we could write a test for this single syntax form, it's very whack-a-mole. What's really needed is defensive coding that systematically avoids making any assumptions about the structure of JuliaSyntax's output (in a recent commit I've moved further towards this), and a proper fuzz-test type approach that generates all sorts of unusual forms.

Given this was part of adapting to a change that happened in the JuliaSyntax 1.0 breaking release, I'm not sure that a regression test for the particular syntax encountered here would be of much value, but what I describe above definitely would be.

Something else that could be useful is to just try highlighting a few sample files that are quite diverse in terms of syntax.

@mbauman
Copy link
Member Author

mbauman commented Feb 28, 2025

While we could write a test for this single syntax form, it's very whack-a-mole.

That's exactly the point of a regression test, though. You just keep whacking moles!

KristofferC pushed a commit that referenced this issue Mar 3, 2025
This updates the pin to point to main rather than a PR again, and also
includes the commit:

```
b7a1c63 * Guard against assumptions that children exist
```

Fixes #57402

(cherry picked from commit 61de3a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system regression Regression in behavior compared to a previous version REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants