Bug Fix: Fixed bug in type narrowing logic when the narrowed expression contained an assignment expression (walrus operator). It was not properly narrowing the target of the assignment expression.
Bug Fix: Fixed bug in "isinstance" type narrowing support when the first argument is a type (e.g. a class or Type[T]) and the second argument is type
(or a tuple that contains type
).
Bug Fix: Fixed bug in "isinstance" type narrowing logic where it didn't properly handle protocol classes that support runtime checking.
Enhancement (from Pylance): Improved docstring formatting in hover text.
Behavior Change: Suppressed "access to non-required key" diagnostic if the access is performed within a try block.
Bug Fix: Fixed bug in 'callable' type narrowing logic. It wasn't properly handling type variables.
Enhancement: Implemented new diagnostic rule "reportUnnecessaryComparison". It checks for "==" and "!=" comparisons where the LHS and RHS types have no overlap and the LHS has no __eq__
overload. This new diagnostic rule is off by default in normal type checking mode but is on in strict mode.
Bug Fix: Fixed false positive error that occurred when file started with "from typing import Collection". This was due to mishandling of a cyclical dependency in the typeshed classes.
Enhancement: Improved bidirectional type inference for expressions that involve the pattern [<list elements>] * <expression>
.
Bug Fix: Fixed false positive error relating to the use of parentheses in "with" statement when using Python 3.9.
Bug Fix: Fixed bug in type evaluation of async functions that are not generators but have a declared return type of AsyncGenerator. The actual return type needs to be wrapped in a Coroutine in this case.
Bug Fix: Suppressed diagnostic check for Subscript for class "X" will generate runtime exception
when it's used in a PEP 526-style variable type annotation. Apparently the exception occurs only when used in other contexts like parameter and return type annotations.