1.1.357
版本发布时间: 2024-04-03 22:56:50
microsoft/pyright最新发布版本:1.1.387(2024-10-30 09:17:48)
Bug Fixes:
- Fixed bug that results in a false positive error when explicitly calling
__new__
on a dataclass, namedtuple, or TypedDict. These classes all require synthesized__new__
methods. - Fixed bug that results in false negative when a
__new__
or__init__
method cannot be bound without a type violation. - Fixed a bug that results in incorrect type narrowing of enums that derive from
enum.Flag
. - Fixed a type hole when a dictionary expression includes a dictionary expansion operator that acts on a non-closed TypedDict.
- Fixed bug that results in a type not being narrowed when using the
K in TD
type guard pattern (whereTD
is a TypedDict andK
is a literal key). Narrowing was skipped if the RHS operand was not a simple identifier. - Fixed inconsistent handling of literal values in a list comprehension.
- Fixed a bug that results in a false positive error when an unpacked TypeVarTuple is used in a function defined with PEP-695 syntax.
- (From Pylance) Improved heap usage tracking within language server to reduce the likelihood of crashes related to heap exhaustion.
- Fixed a bug that results in incorrect inferred parameter types for an unannotated method in a subclass when the parent class method contains function-scoped TypeVars.
Enhancements:
- Added support for negative (fall-through) type narrowing for subject subexpressions in
match
statement when subject consists of a tuple expression and patterns exhaustively match the tuple. - Enhanced dictionary type evaluation to support dictionary items that overwrite previous dictionary items. Only the last value type is now considered, so if previous values (which are overwritten) would otherwise violate typing rules, this no longer generates a type error.
- Enhanced discriminated class support to include not only literal field values but also
None
. - Improved diagnostic message for access to unknown member in the case where the user probably meant to access an item in a TypedDict but used a member access expression rather than an index expression.
- Improved return result for synthesized
get
method for closedTypedDict
classes (as defined in PEP 728). - Refactored tokenizer and parser output to help reduce the amount of memory needed.
Behavior Changes:
- Changed the handling of
Final
variables (that are not explicitly markedClassVar
) within dataclass class bodies. This is consistent with the runtime and this proposed change to the typing spec.
1、 vscode-pyright.vsix 4.99MB