-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix erroneous code path within show_sym
#38830
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
currently, `show_sym` can recur into `show(::IO, String)`, but it's a bit "erroneous" since `is_syntactic_operator(::String)` is not defined. the virtual stacktrace from [JET.jl](https://github.com/aviatesk/JET.jl) may describe this better: ```julia julia> @report_call println(QuoteNode(nothing)) ═════ 1 possible error found ═════ ┌ @ coreio.jl:4 Base.println(Core.tuple(Core.typeassert(Base.stdout, Base.IO)), xs...) │┌ @ strings/io.jl:73 Base.print(Core.tuple(io), xs, Core.tuple("\n")...) ││┌ @ strings/io.jl:46 Base.print(io, x) │││┌ @ show.jl:1144 Base.show_unquoted(Base.IOContext(io, Base.=>(:unquote_fallback, false)), ex, 0, -1) ││││┌ @ show.jl:1496 Base.show_unquoted_quote_expr(io, Base.getproperty(ex, :value), indent, prec, 0) │││││┌ @ show.jl:1522 Base.show_block(Base.IOContext(io, Base.=>(Base.beginsym, false)), "quote", value, indent, quote_level) ││││││┌ @ show.jl:1365 Base.show_block(io, head, Base.vect(), block, i, quote_level) │││││││┌ @ show.jl:1361 Base.show_unquoted(io, ex, ind, -1, quote_level) ││││││││┌ @ show.jl:1955 Core.kwfunc(Base.show_globalref)(Core.apply_type(Core.NamedTuple, (:allow_macroname,))(Core.tuple(true)), Base.show_globalref, io, arg1) │││││││││┌ @ show.jl:1468 Base.#show_globalref#424(allow_macroname, _3, io, ex) ││││││││││┌ @ show.jl:1474 Core.kwfunc(Base.show_sym)(Core.apply_type(Core.NamedTuple, (:allow_macroname,))(Core.tuple(allow_macroname)), Base.show_sym, io, Base.getproperty(ex, :name)) │││││││││││┌ @ REPL[7]:2 Base.#show_sym#882(allow_macroname, _3, io, sym) ││││││││││││┌ @ REPL[7]:6 Base.show_sym(io, Base.getindex(sym_str, Base.:(2, Base.lastindex(sym_str)))) │││││││││││││┌ @ REPL[7]:2 Base.#show_sym#882(false, #self#, io, sym) ││││││││││││││┌ @ REPL[7]:2 Base.is_valid_identifier(sym) │││││││││││││││┌ @ show.jl:1410 Base.is_syntactic_operator(sym) ││││││││││││││││ no matching method found for call signature: Base.is_syntactic_operator(sym::String) │││││││││││││││└──────────────── Core.Const(nothing) julia> # fix this @eval Base function show_sym(io::IO, sym; allow_macroname=false) if is_valid_identifier(sym) print(io, sym) elseif allow_macroname && (sym_str = string(sym); startswith(sym_str, '@')) print(io, '@') show_sym(io, Symbol(sym_str[2:end])) else print(io, "var", repr(string(sym))) end end show_sym (generic function with 1 method) julia> @report_call println(QuoteNode(nothing)) No errors ! Core.Const(nothing) ```
Let's also add |
JeffBezanson
approved these changes
Dec 11, 2020
aviatesk
added a commit
to aviatesk/JET.jl
that referenced
this pull request
Dec 12, 2020
this makes it test pass regardless of JuliaLang/julia#38830
@JeffBezanson should this be backported to 1.6? |
antimon2
pushed a commit
to antimon2/julia
that referenced
this pull request
Dec 21, 2020
fix erroneous code path within `show_sym` currently, `show_sym` can recur into `show(::IO, String)`, but it's a bit "erroneous" since `is_syntactic_operator(::String)` is not defined.
I have sent PR to backports-release-1.6 ( #38955 ) due to the following error in Julia v1.6-DEV:
This error will be fixed by applying this commit.
|
KristofferC
pushed a commit
that referenced
this pull request
Jan 19, 2021
KristofferC
pushed a commit
that referenced
this pull request
Feb 1, 2021
ElOceanografo
pushed a commit
to ElOceanografo/julia
that referenced
this pull request
May 4, 2021
fix erroneous code path within `show_sym` currently, `show_sym` can recur into `show(::IO, String)`, but it's a bit "erroneous" since `is_syntactic_operator(::String)` is not defined.
staticfloat
pushed a commit
that referenced
this pull request
Dec 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
currently,
show_sym
can recur intoshow(::IO, String)
, but it's abit "erroneous" since
is_syntactic_operator(::String)
is not defined.the virtual stacktrace from JET.jl
may describe this better: