Plugins and overloads don't interact well
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 20.6k
- Fork
- 3.3k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
While working on our own plugin for self-checking proper types and isinstance() I have tried to use get_function_hook() to emit some additional errors for overloaded functions. However this didn't work for three reasons:
- The hook is called for every item in the overload, not for the overload as a whole.
- The overload logic relies on empty
Messagesas a sign of successful match - The errors emitted during overload selection are discarded afterwards, thus discarding the plugin generated errors
This issue can be fixed in three ways:
- Calling the hook on the overload as a whole after selecting the overload variant and type checking it (this however will be a breaking API change)
- Use newly added error codes to only abandon a variant if the error is due to bad argument type (this is however still bad because
check_call()may have anaccept()call possibly triggering almost arbitrary error including a nested function call with bad argument type). - Use a boolean attribute somewhere that will be set by
check_argument_types()and will be reset after return from everyaccept().
I am leaning towards the last option, since it is most principled IMO.
cc @Michael0x2a
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 tracciando get_function_hook() attraverso la selezione degli overload, check_call(), check_argument_types() e accept(). Confronta il modo in cui la corrispondenza degli overload utilizza Messages vuoti e il modo in cui gli errori dei plugin vengono scartati. Il lavoro è completato quando gli errori generati dai plugin sopravvivono alla selezione degli overload senza rifiutare erroneamente varianti di overload valide, mantenendo al contempo coerente il comportamento selezionato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- compilers, devtools
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100