Performance: Added code to handle pathological case in unannotated code that assigns values to the same variable hundreds of times with different types.
Bug Fix: Fixed a recent regression that resulted in unsolved type arguments when a "bare" generic class (like dict
) is passed as an argument to a function that accepts a type[T]
.
Bug Fix: Fixed a bug in type narrowing for pattern matching in the negative (fall-through) case when the subject type contains an Any
.
Enhancement: Added additional special-case handling for __init_subclass__
and __class_getitem__
to treat them as implicit class methods even if they are not declared using a def
statement.
Bug Fix: Fixed bugs that resulted in incorrect or incomplete types when narrowing for sequence patterns in the negative case and the subject expression is a super-type of Sequence
(such as object
or Reversible
).
Behavior Change: Modified is None
type guard logic to eliminate Any
or Unknown
in the positive narrowing case.
Bug Fix: Fixed bug that resulted in a false positive reportOverlappingOverload
error when overload contained the use of a constrained TypeVar.
Bug Fix (thanks to @ adpauls for contribution): Add fsevents as optional dependency to public package. This should improve file watcher behavior for large projects on MacOS.
Enhancement: Improved the error message for incompatible type arguments. Many users are confused about variance (in particular invariant type parameters). This change should help eliminate some of that confusion.
Bug Fix: Fixed a bug that resulted in a false negative when assigning a T | None
type to object | None
in an invariant context. This same bug led to issues with the validation of TypeVar variance within a Protocol.
Bug Fix: Fixed recent regression that resulted in a false positive error when using bidirectional type inference for an assignment to a class-scoped variable where the annotated type is a descriptor.
Enhancement: Improved checks for illegal use of a variable within a type expression. Added enforcement of these same rules for the first argument to a cast
call.
Behavior Change: Removed the requirement that a TypedDict
be marked @final
for it to be considered for type narrowing as part of a S in D
type guard pattern. This requirement wasn't sound because TypedDict is a structural type (i.e. a protocol), so @final
doesn't have any real meaning.
Enhancement: Updated typeshed stubs to the latest version.
Bug Fix: Fixed bug that caused an error to go undetected when the LHS of a call expression is a union that includes an abstract static or class method.
Bug Fix: Fixed a bug that resulted in incorrect evaluation of a type alias defined with typing.TypeAlias
and consisting of a single (naked) type variable.
Bug Fix: Fixed a bug that resulted in a false positive when an expression of type type[Self]
was used as the base type for a member access expression that was then used to call an instance method on that class.
Bug Fix: Fixed a bug that led to a false negative when determining type compatibility between two unions in an invariant context.
Bug Fix: Fixed bug that resulted in the incorrect variance inference of an "auto variance" type parameter (as introduced in PEP 695).