Extend operator-typo SyntaxError suggestions (`=<`, `=>`, `=!`) to `if/while` other conditions
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Follow-up #151375
In that PR we added helpful SyntaxError messages for common operator typos: =< suggests <=, => suggests >=, and =! suggests !=.
These suggestions currently only work when the typo appears in a plain statement. like
'a => b' invalid syntax. Maybe you meant '>=' instead of '=>'?
So this is for extending in if, while, or other conditions:
These only fire for bare statements, so
if a => b:still gives the generic error, no? That is probably fine for a first iteration (the= <tokenization makes it look like an assignment), but maybe we should add a test documenting it or a follow-up issue for theif/whilecase.
Originally posted by @pablogsal in https://github.com/python/cpython/pull/151375#discussion_r3683730462
I'm planning to work on this and submit a PR shortly after the follow up merged, please avoid PR in this
Guida per i contributori
Apri 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.
Direzione di ricerca
Inizia leggendo PR #151375 e l’implementazione esistente dei suggerimenti di SyntaxError per capire come vengono rilevati gli errori di battitura degli operatori nelle istruzioni isolate. Estendi il comportamento a if, while e agli altri casi condizionali, quindi aggiungi o aggiorna i test che coprono queste forme e verifica i messaggi suggeriti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100