We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The type revealed when type checking the above fragment changed as a side effect of #16184, and this looks like a regression:
from typing import TypeVar T = TypeVar("T", bound="Base") class Base: def __abs__(self: T) -> T: return type(self)() class C(Base): pass def f(values: list[T]) -> T: return values[0] def g() -> None: x = abs(f([C()])) reveal_type(x) # "Base", but expected "C" <<------
cc @ilevkivskyi
The text was updated successfully, but these errors were encountered:
Inner vs outer context was always a bit arbitrary, but indeed, the new behavior is inconsistent, #16344 should restore the consistency.
Sorry, something went wrong.
Use upper bound as inference fallback more consistently (#16344)
b41c8c1
Fixes #16331 Fix is straightforward: do not use the fallback, where we would not give the error in the first place.
Successfully merging a pull request may close this issue.
The type revealed when type checking the above fragment changed as a side effect of #16184, and this looks like a regression:
cc @ilevkivskyi
The text was updated successfully, but these errors were encountered: