Error labels inside f-strings and s-strings shift left after escape sequences or triple quotes
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 10.9k
- Fork
- 261
- Merge medio
- 3g 21h
- PR unite (30g)
- 84
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PRQL/prql
-
Underscore does not work as expectedForse già presa @prql-bot l’ha presa 1 giorno fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
prqlc Debug Report HTML Does Not Escape Source File Name, Enabling Stored XSS via PRQLC_DEBUG_LOGApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 3 giorni
-
Add `.prql` to linguistApertafriendliness integrations
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
PRQL/prql#1636 · 2 commenti · 2 reazioni ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 12/100
I maintainer di solito rispondono entro 3 giorni
-
review-runs-tracking
Difficoltà 3/5 Mezza giornata Idoneità per principianti 5/100
I maintainer di solito rispondono entro 3 giorni
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
test(hydro_std): track_membership join and leave are untestedForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
hydro-project/hydro#3289 ·
I maintainer di solito rispondono entro 1 giorno
-
diagram-bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
enhapu-afk/omaspec#4 ·
-
priority: low ☕️ type: bug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
bug security
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 4 giorni