Bug Fixes:
- Fixed a bug that resulted in a false positive when applying a descriptor whose
__get__
method whoseowner
parameter is annotated withtype[T]
. - Fixed bug that affected the
isinstance
type narrowing logic when the pre-narrowed type is a type alias that refers to a union that includes a recursive type alias. - Fixed bug in completion provider that resulted in incorrect keyword parameter suggestions for positional-only parameters.
- Fixed bug that led to a spurious "unknown argument type" when passing an unpacked tuple in a call expression.
- Fixed regression that results in a false positive when using a value of type
type[Protocol]
as the second argument toisinstance
orissubclass
if the protocol isn't@runtime_checkable
. - Fixed regression that resulted in false positive errors when a magic method (e.g.
__lt__
or__add__
) are implemented with a callable protocol object. - Fixed a bug that resulted in a false positive error when using a walrus operator in a call expression that targets an overloaded function.
- Fixed bug that led to a hang (infinite loop) in the language server when opening a document whose URI wasn't a "file". This occurred in some language servers that used an "untitled" (or similar) URI type for new documents.
- Modified recent bug fix in
isinstance
andissubclass
type narrowing logic so it better handles type variables with bounds that are unions. - Fixed a bug that resulted in a false positive error when a higher-order generic function is passed another generic function as an argument along with another argument that dictates the type of the first argument's type variable(s). This shouldn't depend on the order in which the arguments are passed.
- Fixed a bug that resulted in a false positive error when a higher-order generic function is passed another generic function as an argument along with another argument that dictates the type of the first argument's type variable(s). This shouldn't depend on the order in which the arguments are passed.
- Fixed a recent regression that resulted in a false positive error when a parent class defines a property with a getter and a child class extends the property with a setter.
- Fixed bug that led to an incorrect type evaluation when a list comprehension expression is used with bidirectional type inference and the expected type includes a type variable.
- Fixed bug that led to a false positive error when a
__getitem__
returnsSelf
. - Fixed a bug that led to a false positive when determining the type compatibility of two TypedDict definitions whose keys were typed with unions that included two other (compatible) TypedDict definitions.
- Fixed a bug that led to incorrect type evaluation when two lists with different types were concatenated using a
+
operator in a bidirectional inference context. - Fixed a bug that results in incorrect type evaluation of an index expression when the LHS is unbound. It should produce
Unknown
rather thanNever
. - Fixed bug that resulted in a false positive under certain circumstances where a recursive type alias was used and hit an internal recursion limit.
Enhancements:
- Improved lambda inference logic to handle the case where the expected type is a callable that accepts a generic callable as a parameter.
- Added error reporting for illegal use of
TypedDict
orProtocol
within a TypeVar bound or within a type annotation. - Enhanced
reportInvalidTypeVarUsage
diagnostic message to include a recommended fix. - Added check for the use of a bare
Literal
(with no type arguments) in places where it's not allowed.
Behavior Change:
- Adjusted heuristic for
reportInvalidTypeVarUse
so it doesn't emit a warning when an unbound TypeVar is used within a subscript.