npm pyright 1.1.372
Published 1.1.372

latest releases: 1.1.388, 1.1.387, 1.1.386...
3 months ago

Bug Fixes:

  • Fixed bug that can result in incorrect evaluation of a traditional (pre-PEP 695) type alias the defines a union which is later used as the second argument to an isinstance or issubclass call.
  • Fixed bug in type narrowing logic for sequence pattern matching when a "star" entry in the pattern captures a TypeVarTuple. The resulting type should be Unknown rather than the unpacked TypeVarTuple.
  • (from pylance) Fixed regression that broke CLI when used with poetry or other tools that depend on the working directory.
  • Fixed a recent regression that results in a false positive when the fully-qualified form of typing.Request is used in an annotation expression.
  • Fixed a bug that results in false positive reportInconsistentConstructor errors if one or both of __init__ or __new__ are overloaded.
  • Fixed a bug that results in a false positive reportOverlappingOverload error in certain cases involving ParamSpec and Concatenate.
  • Fixed a bug that results in incorrect import resolution behaviors when a ".py" file and a directory have the same name, and the directory doesn't have a __init__.py file in it. In this case, the ".py" file should take precedence during imports.
  • Fixed inconsistent behavior when evaluating a binary expression with an or or and operator when the LHS evaluates to a literal int, str, bytes or bool type.
  • Fixed bug that results in a false positive error under certain circumstances when a generator function with no type annotation contains a return value.
  • Fixed bug that results in some circumstances in incorrect specialization of type[T] when T evaluates to Any.
  • Fixed false positive error when using an overloaded __init_subclass__ method under certain circumstances.

Enhancements:

  • Added support for negative type narrowing (in the fall-through case) for a mapping pattern consisting of a single dictionary expand entry. This should match all mapping types, eliminating them in the fall-through case.
  • Added support for class declarations within an enum class body -- both with and without @member and @nonmember decorators.
  • Added "literal math" support for bitwise operators (left shift, right shift, logical or, logical and, logical xor, and invert).
  • Improved the handling of bidirectional type inference for call expressions when the expected type comprises a union.
  • Added "literal math" support for exponentiation operator.
  • Improved performance of type analyzer an average of 12% by refactoring internal data structures and making key objects "monomorphic". This allows the V8 Javascript engine (used in node) to JIT more optimal code.

Behavior Changes:

  • Changed union creation logic to retain (rather than elide) redundant literals in some cases. In particular, for type expressions that explicitly include literals along with their non-literal counterpart like Literal[1] | int. Retaining these redundant subtypes can be useful for language server features like completion suggestions.
  • Changed the type of the __doc__ attribute for a module to always be str | None. Previously, pyright changed its declared type to str if a docstring was present in the module, but this is incorrect because it's a writable value and can be set to None.
  • Changed logic for explicit specialization to allow Never as a type argument for a value-constrained type parameter if Never is an explicit constraint.

Don't miss a new pyright release

NewReleases is sending notifications on new releases.