Skip to content

Commit

Permalink
Fix LazyString building with non-ASCII preceding $ (#49248)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liozou committed Apr 5, 2023
1 parent 8be6f0f commit bd1a664
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/strings/lazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ macro lazy_str(text)
parts = Any[]
lastidx = idx = 1
while (idx = findnext('$', text, idx)) !== nothing
lastidx < idx && push!(parts, text[lastidx:idx-1])
lastidx < idx && push!(parts, text[lastidx:prevind(text, idx)])
idx += 1
expr, idx = Meta.parseatom(text, idx; filename=string(__source__.file))
push!(parts, esc(expr))
Expand Down
3 changes: 3 additions & 0 deletions test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,9 @@ end
end
return a
end |> Core.Compiler.is_foldable
let i=49248
@test String(lazy"PR n°$i") == "PR n°49248"
end
end

@testset "String Effects" begin
Expand Down

0 comments on commit bd1a664

Please sign in to comment.