-
-
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
Code printing of illegal identifiers, e.g. var"do" #56936
Comments
can i work on this issue? |
Also for NamedTuples: julia> (; var"x" = 1, var"do" = 2, var"end" = 3)
(x = 1, do = 2, end = 3)
julia> (x = 1, do = 2, end = 3)
ERROR: ParseError: |
One potential issue is that
You don't need to ask, if the issue is still open, it's up for grabs |
Seems related: Lines 1462 to 1471 in ed2cb49
julia> ex = :((var"x" = 1, b = 2, c = 3))
:((x = 1, b = 2, c = 3))
julia> Meta.parse(string(ex)) == ex
true
julia> eval(Meta.parse(repr(ex))) == ex
true
julia> ex = :((; var"x" = 1, var"do" = 2, var"end" = 3))
:((; x = 1, do = 2, end = 3))
julia> Meta.parse(string(ex)) == ex
ERROR: ParseError:
# Error @ none:1:11
(; x = 1, do = 2, end = 3)
# └┘ ── invalid `do` syntax
Stacktrace:
...
julia> eval(Meta.parse(repr(ex))) == ex
ERROR: ParseError:
# Error @ none:1:13
:((; x = 1, do = 2, end = 3))
# └┘ ── invalid `do` syntax
Stacktrace:
... |
It's arguably a quirk of parsing/lowering that julia> let var"end"=1; (1:10)[var"end"]; end
10 # anything else than "end", and you get 1 |
Seems a new bug? julia> isdefined(Main, :end)
false
julia> print(var"end")
ERROR: UndefVarError: `end` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] top-level scope
@ REPL[2]:1
julia> (1:3)[var"end"]
3
julia> (1:3)[var"let"]
ERROR: UndefVarError: `let` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
[1] top-level scope
@ REPL[5]:1
julia> var"let" = 2
2
julia> (1:3)[var"let"]
2 |
The first is expected, the latter two are a bug and should be printed as they are input:
The text was updated successfully, but these errors were encountered: