Skip to content

Commit ab206cb

Browse files
LiozouKristofferC
authored andcommitted
Fix LazyString building with non-ASCII preceding $ (#49248)
(cherry picked from commit bd1a664)
1 parent f8a4a37 commit ab206cb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

base/strings/lazy.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ macro lazy_str(text)
6767
parts = Any[]
6868
lastidx = idx = 1
6969
while (idx = findnext('$', text, idx)) !== nothing
70-
lastidx < idx && push!(parts, text[lastidx:idx-1])
70+
lastidx < idx && push!(parts, text[lastidx:prevind(text, idx)])
7171
idx += 1
7272
expr, idx = Meta.parseatom(text, idx; filename=string(__source__.file))
7373
push!(parts, esc(expr))

test/strings/basic.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,4 +1144,7 @@ end
11441144
end
11451145
return a
11461146
end |> Core.Compiler.is_foldable
1147+
let i=49248
1148+
@test String(lazy"PR n°$i") == "PR n°49248"
1149+
end
11471150
end

0 commit comments

Comments
 (0)