Commit 04b86b7
Print var"string" as raw string (#57887)
Fixes #57076. As stated in a TODO comment, `show_sym` prints `var""`
symbols as ordinary strings (where [many
things](https://github.com/JuliaLang/julia/blob/master/base/strings/io.jl#L485-L491)
are escaped), but it should be a raw string (where only quotes and some
backslashes are escaped). This fails the eval-parse-repr printing test.
On master:
```
julia> a = :(var"\t,\$,\",\\,\u03c0," = 1)
:(var"\\t,\\\$,\",\\\\,\\u03c0," = 1)
julia> a = eval(Meta.parse(repr(a)))
:(var"\\\\t,\\\\\\\$,\",\\\\\\\\,\\\\u03c0," = 1)
julia> a = eval(Meta.parse(repr(a)))
:(var"\\\\\\\\t,\\\\\\\\\\\\\\\$,\",\\\\\\\\\\\\\\\\,\\\\\\\\u03c0," = 1)
```
This PR:
```
julia> a = :(var"\t,\$,\",\\,\u03c0," = 1)
:(var"\t,\$,\",\\,\u03c0," = 1)
julia> a = eval(Meta.parse(repr(a)))
:(var"\t,\$,\",\\,\u03c0," = 1)
```
---------
Co-authored-by: Keno Fischer <[email protected]>1 parent 58deac9 commit 04b86b7
2 files changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1832 | 1832 | | |
1833 | 1833 | | |
1834 | 1834 | | |
1835 | | - | |
| 1835 | + | |
1836 | 1836 | | |
1837 | 1837 | | |
1838 | 1838 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2815 | 2815 | | |
2816 | 2816 | | |
2817 | 2817 | | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
0 commit comments