Bug Fix: Fixed bug that resulted in the incorrect type when bidirectional type inference (an "expected type") was used in conjunction with the tuple()
constructor.
Behavior Change: Changed logic to avoid reanalyzing a file when it is opened in the editor if we have already analyzed it and the file contents are the same as before.
Bug Fix: Improved handling of call expressions where the call is a union and some of the subtypes return NoReturn and others do not.
Behavior Change: Changed the logic that validates the assignment to instance variables that are marked Final
. Previously, only one such assignment was allowed even if it was within an __init__
method. It now allows an arbitrary number of assignments (conditional or otherwise) as long as they occur within an __init__
method.
Enhancement: Enhanced "reportIncompatibleVariableOverride" diagnostic check to detect the case where a base class declares a class variable and a child class tries to override it with an instance variable or vice versa.
Bug Fix: Added logic to handle the case where a dataclass subclass overrides a member of its parent class with a ClassVar and another dataclass then subclasses from the child.
Enhancement: Enhanced type stub generator so it doesn't emit "object" as base class, since that's implied in Python 3.x.
Enhancement: Enhanced type stub generator to emit inferred function and method return types as comments.
Behavior Change: Removed false positive error reported for a "bare" raise
statement outside of an except
clause.
Bug Fix: Changed type variable constraint solver to preserve literal types when matching type arguments from other class types. In other cases, it typically "strips" the literal, widening the type to a str, int, etc. This change allows proper type evaluation in certain cases where a literal type is specified in a type annotation, such as with Set[Literal["foo"]]
.
Bug Fix: Fixed bug in code flow engine where it was sometimes evaluating the wrong type when cycles occurred in type dependencies.
Bug Fix: Fixed bug that can result in a crash when indexing a file that includes a nested function or lambda that is used for type inference.
Enhancement: Improved detection and reporting of illegal type alias recursion cases — e.g. when a possible type alias refers to a function that uses the type alias in parameter or return type annotations.
Enhancement: Changed type printer to include a "*" after a type if it is conditionally associated with a TypeVar constraint.
Bug Fix: Augmented type checking logic for generator expressions to allow await
keyword even though enclosing function isn't async. Also allowed generator expression to be evaluated as AsyncGenerator
rather normal Generator
.
Enhancement: Changed the way conditional constraints are tracked in the type evaluator. This is a significant change that simplifies the logic and handles some cases that the old approach did not.