Error labels inside f-strings and s-strings shift left after escape sequences or triple quotes
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start in prqlc/prqlc-parser/src/parser/expr.rs around the interpolation::parse(string, span + 2) call, then inspect the lexer’s TokenKind::Interpolation data and interpolation parsing. Reproduce the reported f-string and s-string cases with escapes and triple quotes, and trace how decoded content maps to source spans. Done means error labels point to the actual expression column for all listed forms without regressing existing interpolation behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Error labels inside an f-string or s-string point at the wrong column when the string has escape sequences or uses triple quotes before the {expr}. Each escape sequence moves the label one column left. Triple quotes move it two columns left.
from t
select {x}
derive {y = f"\t\t\t\t{foo}"}
On main (556b1458) the error points at column 20, which is the first \t. foo actually starts at column 24:
3 │ derive {y = f"\t\t\t\t{foo}"}
│ ─┬─
│ ╰─── Unknown name `foo`
The same query written as f"aaaa{foo}" labels column 20, which is correct. f"""aaaa{foo}""" also labels column 20, but there foo starts at column 22. s"…" behaves the same way.
Cause. expr.rs#L223 calls interpolation::parse(string, span + 2). That assumes the string's content starts two characters after the token: one for the f/s prefix and one for the quote. It also assumes each character of string maps to one character of the source. Both assumptions break:
TokenKind::Interpolation(char, String)holds the string after the lexer has decoded escapes, so\t(two source characters) becomes a single character.- A triple-quoted string has two more opening quotes than the
+ 2allows for.
A fix would need the lexer to keep enough information to map positions in the decoded content back to source positions: at least the opening quote count, plus an offset table for escapes or the raw slice. TokenKind::Interpolation is the natural place to carry it. Changing that token is a design choice, so this is filed as an issue rather than a direct PR.
The nightly run 36975211955 found this but was stopped by a usage limit before it could act. The repro above was re-run on main at 556b1458. #6383 changes how malformed escapes are decoded but not the span offset, so it doesn't overlap.
- Ngôn ngữ chính
- Rust
- Star
- 10.9k
- Fork
- 261
- Merge trung bình
- 3 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 85
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PRQL/prql
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
PRQL/prql#6518 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
prqlc Debug Report HTML Does Not Escape Source File Name, Enabling Stored XSS via PRQLC_DEBUG_LOGĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
PRQL/prql#6502 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Add `.prql` to linguistĐang mởfriendliness integrations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
PRQL/prql#1636 · 2 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Creation allowance reachedĐang mởtend-rate-limit
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 4/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 12/100
PRQL/prql#6517 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 70/100
OpenZeppelin/openzeppelin-relayer#967 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DecisionOutcome::label() / n_dosed(): engine-side mapping so downstream needs no wildcard armĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
src/runs.rs:1987: a missing --source-run-id now answers 400 "Source run ... does not exist", not 404Đang mởnightly-audit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
antithesishq/snouty#602 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
libnativeapi/nativeapi#21 ·