Skip to content

Commit bd1a664

Browse files
authored
Fix LazyString building with non-ASCII preceding $ (#49248)
1 parent 8be6f0f commit bd1a664

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
@@ -1191,6 +1191,9 @@ end
11911191
end
11921192
return a
11931193
end |> Core.Compiler.is_foldable
1194+
let i=49248
1195+
@test String(lazy"PR n°$i") == "PR n°49248"
1196+
end
11941197
end
11951198

11961199
@testset "String Effects" begin

0 commit comments

Comments
 (0)