TransformVisitor (and StrConv) are slightly out-of-sync with node definitions

Aperta
#2,109 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
compilers

Direzione di ricerca

Review TransformVisitor in mypy.treetransform and StrConv in mypy.strconv against the node definitions in mypy.nodes; start with the listed visitor methods and attributes. Check related visitors for similar mismatches, then add coverage that detects missing copied attributes and verify the listed cases are handled.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

refactoring

I recently noticed that mypy.treetransform.TransformVisitor seems to be slightly out-of-sync with the nodes within mypy.nodes.

For example...

  • visit_func_def isn't copying over the is_generator, is_coroutine, and is_awaitable_coroutine attributes
  • visit_var isn't copying over the is_suppressed_import attribute
  • visit_with_statement isn't copying over is_async
  • visit_class_def isn't copying over has_incompatible_baseclass

Currently, it doesn't seem like these omissions are too harmful since the only place we use TransformVisitor is within TypeTransformVisitor (which only expands types). However, I could see this might lead to subtle bugs in the future, so it's probably worth fixing this now and perhaps coming up with some sort of test that will automatically catch these sorts of discrepancies in the future.

mypy.strconv.StrConv also seems to have similar issues, though it's probably even less of a priority. I haven't really checked the other visitors, so I don't know if they're similarly desynched.

(I'm filing this issue to make sure I don't forget about it).

Lingua principale
Python
Stelle
20.6k
Fork
3.3k
Merge medio
1g 18h
PR unite (30g)
54

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python/mypy

Tutte le issue di python/mypy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.