Base.isidentifier(::Symbol) should check normalization #52641
Labels
bug
Indicates an unexpected problem or unintended behavior
display and printing
Aesthetics and correctness of printed representations of objects.
good first issue
Indicates a good issue for first-time contributors to Julia
parser
Language parsing and surface syntax
As discussed on discourse, while the
Symbol("...")
foo constructor allows one to construct invalid Julia identifiers and in particular identifiers lacking normalization (an intentional decision way back in #5462), theBase.isidentifier
function doesn't check for normalization ofSymbol
arguments.This also has the consequence that
show
is incorrect for non-normalizedSymbols
, since it checksisidentifier
to see whether they can be printed as:foo
rather than asSymbol("foo")
:My suggestion is that
julia/base/show.jl
Line 1538 in 66e9410
(Note that
isidentifier
should continue to not check normalization for::String
arguments, since in that case it has a slightly different meaning — it checks whether the string can be parsed into a valid identifier.)The text was updated successfully, but these errors were encountered: