f-string interpolation calls `str` by name, so a user binding named `str` changes every f-string
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c
- Ambito
- compilers, testing-qa
Direzione di ricerca
Start in the f-string block of src/lexer.c and inspect the lowering used by the VM, then compare the ouroboros frontend/AOT path. Run the two reproductions with EIGS_JIT_OFF=1 and use tests/test_fstrings.eigs as the regression-test entry point. Done means the global, defined, and function-local str cases produce the specified result or fail loudly, with both lowering paths aligned.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The lexer lowers f"a{e}b" to ("a" + (str of (e)) + "b") using an ordinary TOK_IDENT "str" (src/lexer.c, f-string block). That identifier is resolved like any other name at run time. A program that binds str therefore changes, or breaks, every f-string evaluated in that scope. Nothing in the source of the f-string mentions str.
Reproduce (origin/main 94c4c5b, release build)
define str(x) as:
return "HIJACK"
print of f"<{5}>"
Actual: exit 0, stdout <HIJACK>. Expected: <5> (or a loud error, if rebinding str is to be forbidden).
str is 3
print of f"<{str}>"
Actual: exit 1, Error line 2: cannot call num. The failing call is one the user never wrote.
The first case is a silent wrong answer (PRINCIPLES.md §2). A str local inside a function body does the same thing to every f-string in that function.
Done when
- f-string interpolation converts values with the builtin conversion no matter what
stris bound to in the enclosing scopes (for example, a dedicated opcode or a reserved internal name the user cannot bind). The alternative is a decision, recorded here, that rebindingstris an error. - Both programs above print
<5>and<3>(or fail loudly at the rebinding, if that is the decision), under the VM and withEIGS_JIT_OFF=1. - A regression in
tests/test_fstrings.eigscovers a globalstr, adefine str, and a function-localstr. - The ouroboros frontend/AOT mirror whatever lowering is chosen (it lowers f-strings the same way).
Found while fixing #1244, where the synthetic str token is now marked as having no source span so LSP rename never edits it; this issue is about the runtime meaning of that token.
- Lingua principale
- C
- Stelle
- 3
- Fork
- 7
- Merge medio
- 4h 15m
- PR unite (30g)
- 106
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un 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 InauguralSystems/EigenScript
-
area:lint-tooling bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
InauguralSystems/EigenScript#1340 ·
I maintainer di solito rispondono entro 1 giorno
-
area:stdlib found-by:code-review kind:silent-wrong
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
InauguralSystems/EigenScript#1338 ·
I maintainer di solito rispondono entro 1 giorno
-
area:lint-tooling found-by:critic kind:docs-drift
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
InauguralSystems/EigenScript#1335 ·
I maintainer di solito rispondono entro 1 giorno
-
area:ci found-by:critic kind:gate-defect
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
InauguralSystems/EigenScript#1311 ·
I maintainer di solito rispondono entro 1 giorno
-
enrolment: decide test_gc_runner_controls.py (exempt vs enrol) and whether floors need a ratchetApertaarea:gates found-by:critic kind:decision
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
InauguralSystems/EigenScript#1280 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di InauguralSystems/EigenScript
Issue simili
-
bug needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
netdata/netdata#24062 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
BasedHardware/omi#19463 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
EchoTools/nevr-runtime#30 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
riscv-software-src/riscv-isa-sim#2448 ·
I maintainer di solito rispondono entro 2 giorni