More specific overlapping overload errors

Abierto
#3,819 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
devtools

Línea de trabajo

Start by reproducing the supplied overload example with mypy and trace the existing diagnostic for incompatible overlapping overloads. Identify the overload-checking and error-reporting entry points; done means the diagnostic explains the overlapping call shapes, including the no-argument call, while preserving the existing incompatibility information.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

feature priority-1-normal topic-overloads topic-usability

Again when wrapping my head around #3805, I was thrown off by the output of mypy against:

from typing import *

@overload
def f(arg: str = "foo") -> AbstractSet[Tuple[str, str]]: ...

@overload
def f(arg: int = 0) -> AbstractSet[Tuple[str, Tuple[str, int]]]: ...

which gives

test.pyi:4: error: Overloaded function signatures 1 and 2 overlap with incompatible return types

The problem here is that each overload can be called without arguments (but I didn't see this until an eagle-eyed BDFL pointed it out 😁).

It would be good if the error message could include a little more information about the ways in which the signatures overlap, to make fixing the error an easier experience.

Lenguaje dominante
Python
Estrellas
20.6k
Forks
3.3k
Merge medio
1 d 18 h
PR fusionados (30 d)
54

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python/mypy

Todos los issues de python/mypy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.