pyright

Static Type Checker for Python

OTHER License

Downloads
2.3M
Stars
13.2K
Committers
119

Bot releases are hidden (Show)

pyright - Published 1.1.220

Published by erictraut over 2 years ago

Behavior Change: Changed the type narrowing logic for truthy and falsy conditions to exempt protocol classes.

Bug Fix: Fixed bug that resulted in incorrect type evaluation of an or binary operator when the same expression was used in the LHS and RHS and was always truthy.

Bug Fix: Fixed bug that resulted in the incorrect evaluation of a type resulting from a call to a constructor for an explicitly-specialized generic class in the case where that class implements neither a __new__ nor an __init__ method.

Enhancement: Improved error message for descriptor and property setters.

Bug Fix: Fixed a bug in PEP 646 unpacked tuple support where *args could not be annotated with *tuple type.

Bug Fix: Fixed a false negative in the handling of dataclasses that contain fields with default orders before fields without default values in the case where an __init__ is already defined on the class.

Bug Fix: Fixed bug that results in false positive error when using a PEP 677 callable arrow syntax within a quoted type on Python 3.10 or older.

Bug Fix: Fixed a bug in the code that prints types to text. It was not properly handling the case where a callable contains a synthesized *args parameter with a type that isn't unpacked.

Bug Fix: Fixed false negative where type annotations beginning with "*" were not properly flagged as a syntax error.
Improved support for matching of TypeVarTuple when used with *args parameter.

Bug Fix: Added missing check for a TypeVarTuple value that is not unpacked when passed as an argument.

pyright - Published 1.1.219

Published by erictraut over 2 years ago

Enhancement: Updated typeshed stubs to latest version.

Bug Fix: Fixed a bug that results in a false positive error when using a Self return type for an __aenter__ method.

Bug Fix: Fixed false positive error when P.args or P.kwargs parameter type annotation is wrapped in Annotated.

Bug Fix: Fixed bug that caused false negative when evaluating a recursive type alias involving a tuple.

Bug Fix: Fixed a bug in the bidirectional type inference logic for list, set and dictionary expressions when that affected certain cases where the expected type contained a union.

Bug Fix: Fixed bug that resulted in false negative when using a recursive type alias with dictionary, list or set expressions.

Bug Fix: Fixed bug that resulted in the inappropriate generation of an Unknown type (and therefore false positive errors in strict mode) when using bidirectional type inference with a function that accepts a generic callable parameter.

Bug Fix: Improved detection of NoReturn calls within code flow graph. In particular, the code now handles the case where the LHS of the call expression is a member access expression and the LHS of that expression is a local variable whose type needs to be inferred.

Enhancement: Added better error handling and reporting for dataclass_transform.

Bug Fix: Fixed bug that caused crash when handling bigint literal values.

Bug Fix: Added missing check for a dataclass field that is declared with a default value in a base class but then overridden with one that doesn't include a default value in a child class. At runtime, it still acts as though it has a default value, which is inherited from the base class.

Bug Fix: Fixed bug that prevented the "--verifytypes" feature from working with namespace packages.

Bug Fix: Added missing check for improper use of Unpack when used in some contexts.

pyright - Published 1.1.218

Published by erictraut over 2 years ago

Enhancement: Allow "--watch" to be used in conjunction with "--outputjson" command-line options.

Enhancement: Added support for bidirectional type inference for yield statements. The expected type is based on the first type argument in a Generator or AsyncGenerator return type annotation.

Enhancement: Added the ability to add new symbols to builtins by simply adding a type stub file named __builtins__.pyi locally.

Bug Fix: Fixed a bug that led to a false positive error when handling bidirectional type inference for tuple expressions when the expected type was a union that contained multiple tuple subtypes.

Bug Fix: Fixed a bug that resulted in a false negative when a list comprehension was used within a class body and referenced a class-scoped variable in a subexpression other than the first iterable. This also fixes a similar bug where a lambda was used within a class body and referenced a class-scoped variable in its return expression. These now property generate errors, reflecting the runtime behavior.

Bug Fix: Fixed a bug that resulted in incorrect type inference for positional parameters used in class patterns if the corresponding class was defined in a "py.typed" library and it defined a __match_args__ symbol with no annotation.

Bug Fix: Fixed bug in stub generator that caused it to omit import statements with multi-part names (e.g. import a.b.c) even though there was a reference within the generated stub to the imported module.

Enhancement: Extended type narrowing for class pattern matching so it supports narrowing in the negative case when arguments are present and when the pattern class is generic.

Bug Fix: Fixed a bug that resulted in a false negative when a *args parameter was used in conjunction with a * keyword-only separator parameter. This generates a syntax error at runtime.

Bug Fix: Fixed a false positive error when TypeGuard was used without a type argument in a runtime manner (outside of a type annotation).

Bug Fix: Fixed recent regression that results in false positive errors detected in the reportUnknownParameterType diagnostic check when the function includes a parameter with a double underscore name indicating that it's positional-only.

Enhancement: Improved signature help and hover text for synthesized __init__ dataclass method when a parameter uses a field descriptor with a default value.

pyright - Published 1.1.217

Published by erictraut over 2 years ago

Bug Fix: Fixed a bug that resulted in a false positive error when passing an *args argument typed as an unpacked TypeVarTuple to a function that includes an unpacked TypeVarTuple parameter.

Enhancement: Added special-case bidirectional type inference for the right operand of the "|" and "|=" operators (with an expected type based on the left operand). This supports the case where the left operand is a TypedDict and the right operand is a dict expression that conforms to the TypedDict type.

Bug Fix: Fixed a bug in the reportIncompatibleMethodOverride check that resulted in false positive errors when both the base class and child methods have overloads but the base class does not have an implementation and the child class does.

Enhancement: Updated typeshed stubs to the latest version.

Bug Fix: Fixed a bug that results in false positive errors when a ClassVar type declaration appears within an Annotated.

Bug Fix: Added special-case handling of Generic base types to match the (undocumented) runtime behavior. Without this special-case handling, pyright reports that "a consistent method ordering cannot be found" in some cases where the runtime does not.

Bug Fix: Fixed bug that is leading to some crashes that appear in the telemetry.

Bug Fix: Added recursion detection for wildcard import lookups during code flow.

Bug Fix: Fixed a bug that caused a type alias of Any to be evaluated as Unknown if defined within a py.typed library.

Performance: Improved performance when analyzing types that involve some forms of recursive type aliases.

Enhancement: Added support for typing_extensions.Never and typing.Never type and unified the underlying handling of Never and NoReturn, which are synonyms.

Enhancement: Improved type stub generation code to emit definitions for TypeVar, TypeVarTuple, ParamSpec and NewType.

Behavior Change: Changed heuristics for matching two union types when the destination union includes a combination of concrete types and one or more type variables. This case involves some heuristics in the constraint solver because multiple solutions are possible.

Bug Fix: Fixed a bug that resulted in a false positive when assigning to a field in a dataclass that is annotated with a Callable type.

pyright - Published 1.1.216

Published by erictraut over 2 years ago

Bug Fix: Fixed recent regression that resulted in a crash (stack overflow) in the code flow engine.

Bug Fix: Fixed a bug that resulted in unknown types in member access expressions to go unreported with reportUnknownMemberType was enabled. This occurred when the member access expression was located within a subscript of an index expression.

Performance: Changed the logic that infers a NoReturn type to avoid inferring symbol types. This was causing a bunch of extra work to be performed in complex unannotated code bases like sklearn.

Performance: Fixed performance issue in parser for deeply-nested parenthesized expressions.

Bug Fix: Fixed bug in callable type compatibility logic. It was not properly handling some edge cases where a keyword parameter in the source and destination had an incompatible type if one or both of the types were specialized.

Bug Fix: Fixed a bug that resulted in false positives when specializing a callback protocol with a TypeVarTuple when the callback protocol also contained one or more keyword parameters that were generic.

Bug Fix: Fixed a bug in the protocol invariance checking logic. It wasn't properly handling protocols that used a TypeVarTuple as a type parameter that wasn't last (right-most) in the type parameter list.

Behavior Change: Changed import resolution order to more closely match PEP 561. Typeshed stdlib type stubs are now resolved later in the import resolution process, after all local modules and modules within the python environment.

pyright - Published 1.1.215

Published by erictraut over 2 years ago

Bug Fix: Fixed bug that resulted in crash when extremely large integer literals are encountered.

Bug Fix: Fixed bug that caused "extraPaths" specified for individual execution environment to be combined for all execution environments if a default "extraPaths" was also specified in the same config file.

Bug Fix: Fixed handling of NoReturn type, which should act like Never in that both are considered "bottom types" and are assignable to any other type.

Enhancement: Updated typeshed stubs to the latest.

Enhancement: Added new diagnostic check "reportMatchNotExhaustive" which reports cases where a match statement doesn't exhaustively cover all cases.

Enhancement: Added support for unpack operator for tuples used within type arguments. Support for this new syntax will appear in Python 3.11.

Bug Fix: Added code in parser to detect obscenely deep parse subtrees containing binary and unary operations. These were sometimes leading to crashes in the binder and type evaluator. The parser now replaces them with error parse nodes and reports an error to the user.

Bug Fix: Added recursion check in type guard logic to address stack overflow issue seen in telemetry.

Bug Fix: Fixed bug that produces a false positive when attempting to assign a value of type Type[NoneType] to Type[None]. These are equivalent, so the assignment should be allowed.

Enhancement: Enhanced parser to detect and report a runtime error that occurs when using a generator expression without surrounding parens as an argument within a call expression when more than one argument or a trailing comma is present.

Bug Fix: Fixed a bug that resulted in a false positive when a member access expression targeted an attribute that was returned by a __getattr__ method that returns a descriptor object. The old logic was binding the descriptor to the object, but that's inconsistent with the way things work at runtime.

Enhancement: Improved analysis of finally block and the code that comes after the finally block so type narrowing performed within the finally block in the fall-through case is preserved.

Enhancement: Added support for Final and ClassVar annotations embedded within Annotated. Runtime support has recently been added for this case.

Enhancement: Added support for InitVar that is wrapped in Annotated. Support is being added for this in the runtime.

Enhancement: Added special-case handling for methods declared as returning a Generator, AsyncGenerator or AwaitableGenerator that do not contain a yield statement. This special case applies only to methods declared in stub files, an abstract method, or a protocol definition with no code.

Bug Fix: Improved support for custom subclasses of the builtin property class. Previously, the special-case handling in place for property were not handling these custom subclasses well, and this resulted in several false positive errors and incorrect type evaluations.

pyright - Published 1.1.214

Published by erictraut over 2 years ago

A regression was introduced in the 1.1.213 release that has the potential of impacting many pyright users, so I decided to do a quick update.

Bug Fix: Reverted change from previous release that caused incorrect type evaluations and false positive errors in certain situations involving bidirectional type inference with call expressions.

Enhancement: Updated typeshed stubs to latest.

pyright - Published 1.1.213

Published by erictraut over 2 years ago

Behavior Change: For not-required TypedDict fields, added a second synthesized overload for the two-parameter form of get that specifies the type of the second parameter is the same type as the field value. The other overload allows this second parameter to be of a different type.

Bug Fix: Fixed bug that resulted in a false positive when accessing a field in a base class that provides a __getattr__ method and is use in conjunction with another base class.

Bug Fix: Fixed bug that resulted in crash due to infinite recursion.

Bug Fix: Fixed a bug in the logic that detects duplicate enum members that resulted in a false positive when an enum class has other instance variables that are not enum members.

Bug Fix: Added special-case handling for instance variables in a dataclass that are marked Final. Previously, these were flagged as an error because there was no explicit value assigned to them, but the synthesized __init__ method implicitly initializes them.

Enhancement: Added check for a class that derives from a protocol class where the protocol declares a method with an empty implementation, and the subclass doesn't provide a concrete implementation of the same-named method.

Bug Fix: Fixed a bug that resulted in a false positive type evaluation error when using bidirectional type analysis for a call expression and the return type of the call contained a union of a TypeVar and another type and the expected type contained a union with at least one literal type.

Bug Fix: Fixed bug that resulted in confusing error message when dataclass field was annotated with Self and then the class was subclassed.

Enhancement: Improved the logic that handles instantiation of a custom metaclass when the name of the new class is passed as a string literal to the metaclass constructor.

Enhancement: Improved the bidirectional type inference logic for lambdas to handle the case where one or more of the matching parameter types was a TypeVar.

Bug Fix: Fixed a bug in the parser that resulted in a false negative when using an assignment expression (walrus operator) in the if clause of a list comprehension with no surrounding parentheses.

Enhancement: Added support for bidirectional type inference when an await operator is used in an expression.

Bug Fix: Fixed a bug in the logic that handles classes that are constructed from custom metaclasses.

Enhancement: Added provisional support for the proposed "typing.reveal_type" call.

pyright - Published 1.1.212

Published by erictraut over 2 years ago

Bug Fix: Fixed bug that resulted in false positive when one or more sources of types in TypeVar solving was unknown.

Bug Fix: Fixed bug that resulted in a crash if a TypedDict class was derived from another TypedDict class and the base class had zero fields defined.

Enhancement: Added support for # pyright: basic comment to enable basic type checking in a file.

Bug Fix: Fixed a bug that resulted in a false positive error when determining whether method overrides for a multi-inheritance chain are compatible.

Bug Fix: Fixed bug that resulted in a false positive when using bidirectional inference with a constructor with complex set of covariant, invariant, and contravariant type parameters.

Enhancement: Improved logic for type(x) is y type narrowing pattern so it handles the case where x is Any.

pyright - Published 1.1.211

Published by erictraut almost 3 years ago

Enhancement: Added support for very large integer literals (both in the tokenizer/parser and in the type system for Literals).

Bug Fix: Fixed bug where call to async function that returns NoReturn was treated as a "no-return" function even though it wasn't awaited.

Enhancement: Added check for class or instance variables that are declared but not assigned in a protocol class and not assigned in a concrete class that explicitly derives from the protocol class.

Bug Fix: Fixed bug in type narrowing logic for isinstance calls where the input value includes a Callable and the class list includes a class that is not a runtime-checkable protocol class. In this case, the Callable should not be removed in the negative ("else") case even if the class defines a compatible __call__ method.

Bug Fix: Fixed bug that resulted in a false positive error when assigning a value to a TypedDict with not-required keys when that key had previously been assigned a literal value that narrowed the type.

Behavior Change: Reverted recent change to TypedDict where the single-argument form of get was removed for not-required fields. This caused problems because there is a fallback overload that accepted this case still.

Behavior Change: Changed reportUnknownArgumentType diagnostic check to be suppressed if the argument is an empty list or dict that comes from a [] or {} expression. While these types do technically contain Unknown type arguments, they are not unsafe, so reporting a diagnostic here is just noise.

Behavior Change: Changed the implementation of reveal_type so it no longer returns a literal string type but now accepts optional keyword arguments expected_text and expected_type. The return type of reveal_type is now the same as the type of the first argument, making it consistent with mypy's implementation of reveal_type.

Enhancement: Modified error messages for Required and NotRequired for clarity.

Bug Fix: Fixed bug in parser that resulted in a false negative error when using an assignment expression within a subscript. This is allowed in the grammar as of Python 3.10.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed internal crash caused by infinite recursion.

Bug Fix: Fixed bug that caused a crash in functools.partial special-case logic.

Bug Fix: Fixed bug in type evaluation of index expressions that involve a recursive type alias in the subscript. Also improved text version of expanded types that include recursive type aliases.

pyright - Published 1.1.210

Published by erictraut almost 3 years ago

Behavior Change: Removed support for two-argument form of TypeGuard including support for "type asserts". The feedback on this idea was relatively negative.

Enhancement: Added provisional support for a proposed StrictTypeGuard feature. For details, refer to this discussion.

Enhancement: Added support for old-style (pre-await) coroutines.

Bug Fix: Fixed a bug that resulted in a false positive in cases involving bidirectional type inference with an expected callable type where one or more of the parameter types was a tuple with non-literal element types and the provided argument was a tuple with a literal value.

Bug Fix: Improved limit check for literal math.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug that results in false positive when using a super().__init__ call within a metaclass __init__ method.

Bug Fix: Fixed bug that results in a false positive error when using yield within the outermost iterator of a list comprehension.

Bug Fix: Fixed a bug that resulted in a false positive when importing OrderedDict from typing_extensions. Added a mechanism for loading typeshed modules on demand within the type evaluator, including collections/__init__.pyi which declares the real OrderedDict class.

Enhancement: Added improved checks for size mismatches when unpacking known-length iterables into a list target (like [a, b] = (1, 2, 3)).

Behavior Change: Changed the setdefault method generated for TypedDict classes so it accepts only literal key values. Fixed a bug in the get method generated for TypedDict classes so it accepts arbitrary values for the default value parameter.

Bug Fix: Fixed bug that resulted in incorrect type evaluation when using a generic type alias that consists of a union of multiple type variables that are filled with the same type when the type alias is specialized.

Behavior Change: Modified the reportMissingSuperCall diagnostic based on feedback. It now emits an error for classes that include an __init__ and don't call through to super().__init__ even if that class derives from object, unless it's marked @final.

pyright - Published 1.1.209

Published by erictraut almost 3 years ago

Enhancement: Added support for "literal math" for certain unary and binary operations where the operands are all the same literal class types (str, bytes, int, or bool). For example, Literal[0, 1] + Literal[1, 2] results in type Literal1, 2, 3].

Enhancement: Implemented a new diagnostic check "reportMissingSuperCall" that checks for __init__, __init_subclass__, __enter__ and __exit__ methods that fail to call through to their parent class(es) methods of the same name. This is a common source of bugs. The check is disabled by default. We may eventually enable it by default in strict mode, but we want to get feedback before doing so.

Behavior Change: Changed text output of CLI version to use the word "information" rather than "info" for consistency with JSON output.

Bug Fix: Fixed bug that resulted in a crash if Self was used in a type argument within a method decorator.

Behavior Change: Changed behavior to allow Self to appear within a ClassVar type.

Bug Fix: Fixed bug that resulted in an incorrect type evaluation when Self was used as a return type annotation for a property or class property.

pyright - Published 1.1.208

Published by erictraut almost 3 years ago

Enhancement (from pylance): Added support for USERNAME and VIRTUAL_ENV shell variables in ".env" file.

Enhancement (from pylance): Improved completion provider suggestions for static members.

Bug Fix: Reverted check for base classes that use variables. It was too disruptive, so another approach is needed.

pyright - Published 1.1.207

Published by erictraut almost 3 years ago

Bug Fix: Fixed bug that results in false positive error when a function signature captured by a ParamSpec includes an *args or **kwargs parameter.

Bug Fix: Fixed bug that resulted in false positive error and unclear error message with the reportIncompatibleMethodOverride check.

Behavior Change: Changed type analysis of def statements to insert implicit / parameter (a position-only parameter separator) when one or more parameter names start with double underscores.

Bug Fix: Fixed a bug that resulted in no error being emitted when an await keyword was used with a Generator object.

Bug Fix: Fixed bug that resulted in false positive error when accessing a staticmethod or classmethod from a protocol class.

Bug Fix: Fixed bug that prevented a file-level override of reportUnnecessaryTypeIgnoreComment from working correctly.

Bug Fix: Fixed bug that resulted in a false positive error when adding a 'staticmethod' or 'classmethod' decorator to an already-decorated method.

Enhancement: Updated typeshed stubs to latest.

Enhancement: Improved check for index values for tuples to handle unions of tuples.

Enhancement: Added new diagnostic check reportInconsistentConstructor that checks for inconsistent input signatures between __new__ and __init__ methods.

Bug Fix: Added a check for base classes specified in a class declaration that is not a concrete class but instead a variable (dynamic) type.

pyright - Published 1.1.206

Published by erictraut almost 3 years ago

Bug Fix: Fixed a bug in the logic that determines whether a call expression is a "NoReturn". In particular, the logic wasn't handling the case where the call was to the constructor of a class that had a custom metaclass that defined a __call__ method.

Bug Fix: Fixed regression that caused a false positive error when attempting to invoke constructor for a class derived from ctypes.Structure. This class uses a custom metaclass with a custom __getattr__ method.

Bug Fix: Updated heuristics in type variable constraint solver to better handle literals in the case where bidirectional type inference is being used.

Enhancement: Updated dataclass_transform support so it applies to both metaclasses and base classes to conform to the latest version of the specification.

Bug Fix: Fixed bug that resulted in false positive errors when dealing with protocol classes that referred to themselves internally.

Bug Fix: Fixed bug in reportIncompatibleMethodOverride diagnostic check where it omitted an error if an overridden method had a decorator applied.

Bug Fix: Fixed a bug in the type evaluation of the two-argument for of super() when the second argument is a class instance and the call is made from within a class or static method.

Behavior Change: Added implied position-only parameter separator for Concatenate operator.

Enhancement: Added new diagnostic check reportUnnecessaryTypeIgnoreComment that emits a diagnostic when a # type: ignore comment has no effect.

Bug Fix: Fixed several bugs in type var constraint solver related to functions that have parameters that are callable that have parameters that are callable.

pyright - Published 1.1.205

Published by erictraut almost 3 years ago

Enhancement: Improved type narrowing for x.y == L pattern to also support x.y is L if L is a bool or enum literal.

Bug Fix: Fixed regression that resulted in a false positive error when assigning an empty tuple to a declared type that involved an unbounded tuple.

Bug Fix: Fixed bug that causes a crash due to infinite recursion.

Bug Fix: Fixed recent regression that resulted in a crash when using a zero-length tuple as a function argument.

Bug Fix: Fixed bug that resulted in the first parameter of a local function declared within a method to be interpreted as a "self" parameter.

Bug Fix: Fixed bug that resulted in a false positive when using a decorator that applies to a method and provides a type for the parameter corresponding to "self".

Bug Fix: Fixed bug in tokenizer that resulted in a missing error when the first statement in a source file is preceded by whitespace.

Enhancement: Updated typeshed stubs to latest.

Bug Fix: Fixed bug that resulted in false positive error when a ParamSpec was bound to a generic function with some unresolved TypeVars.

Behavior Change: Changed behavior of type alias declarations that use a generic class or alias in the RHS without any subscripts or unions. These are treated as unspecialized aliases, whereas they were previously specialized with Any type arguments.

pyright - Published 1.1.204

Published by erictraut almost 3 years ago

Behavior Change: Added special-cased handling for __slots__ and __class_getitem__ in protocol matching logic.

Enhancement: Improved bidirectional type inference for lambdas with default argument values.

Enhancement: Improved heuristics for when constraint solver should prefer literals over non-literals when solving a TypeVar in the case of bidirectional inference when assigning to a callable type.

Enhancement: Added support for unpacking of tuples in type annotations (part of PEP 646).

Bug Fix: Fixed bug that resulted in false positive error when a Literal was used within a Python-2 style type annotation comment.

Enhancement: Updated typeshed stubs to the latest.

Bug Fix: Fixed bug in "x is None" type guard logic. It wasn't preserving conditional types if x was a TypeVar.

Bug Fix: Fixed bug that resulted in false positive error when a constrained TypeVar was checked against a particular constraint in an isinstance type guard.

Bug Fix: Fixed a bug in the logic for assignment-based type narrowing that resulted in the wrong narrowed type if the declared type of the destination expression contained a union and the source contained a TypeVar.

pyright - Published 1.1.203

Published by erictraut almost 3 years ago

Happy New Year everyone!

Bug Fix: Fixed false positive error when Optional is used outside of a type annotation with no type arguments.

Enhancement: Added provisional support for "asserting type guard functions", those that return a type of TypeGuard[X, NoReturn].

Enhancement: Added support for type narrowing in pattern classes based on the absence of an attribute (or a pattern mismatch of an attribute) if the class in question is marked @final.

Behavior Change: Changed the behavior for wildcard imports when the target module defines __all__ in a way that pyright cannot understand. Previously, the wildcard import didn't import any symbols in this case. Now, it imports all symbols from the target module.

Enhancement: Added support for undocumented behavior of functools.partial whereby it allows keyword parameters to be overridden by the caller even though they are already supplied in the partial decorator.

Behavior Change: Changed the reportImplicitStringConcatenation diagnostic check to not flag concatenated strings if they are contained within enclosing parentheses.

Bug Fix: Fixed bug that caused __hash__ function not to be synthesized for frozen pydantic models when using dataclass_transform.

Enhancement: Enhanced the "aliased conditional" type narrowing capability to accommodate multiple assignments of the variable used within the aliased conditional as long as the variable isn't reassigned between the the aliased conditional assignment and the conditional check that uses the aliased value.

Enhancement: Added support for bool(x) type guard.

Bug Fix: Fixed several bugs that prevented type narrowing to work correctly when conditional expression included an assignment expression.

Enhancement: Added check for member access expressions that access a member of a protocol class directly from the class. In this case, the member must be declared as a ClassVar.

Enhancement: Improved "x in y" type narrowing logic to better handle literal types in the iterable value y.

Behavior Change: Adjusted heuristics for assignment-based type narrowing. If the RHS type contains an unsolved TypeVar and the LHS (declared) type is concrete, do not apply type narrowing in this case.

Bug Fix: Fixed bug that resulted in unreported type violation (false negative) when an inner function with a ParamSpec used a concatenated parameter but the outer function's return type did not.

Enhancement: Added support for new type narrowing pattern: len(x) == L and len(x) != L where x is a tuple or union of tuples and L is a literal integer value.

pyright - Published 1.1.202

Published by erictraut almost 3 years ago

Enhancement: Added check for class patterns for special builtin types (like int, float, etc.). These class patterns accept at most a single sub-pattern as an argument, and it must be positional.

Bug Fix: Fixed type compatibility bug that allowed Literal[1] to be assignable to type when it should not be.

Bug Fix: Fixed bug that caused "unnecessary isinstance" check to emit a false positive diagnostic when second argument was Literal[1].

Enhancement: Improved heuristics for determining preferred TypeVar match when matching against a union that includes a TypeVar.

Enhancement: Added provisional support for two-argument form of TypeGuard to support negative narrowing cases.

Bug Fix: Fixed bug in hover provider that caused docstrings not to appear for callable types that were generated from a callable with a ParamSpec.

Bug Fix: Fixed a bug that resulted in a missing type error when a generic function returned a Callable type that used a TypeVar in its parameter types.

Bug Fix: Fixed regression that resulted in a crash under certain circumstances where a finally clause was used in a generic function that used constrained TypeVars.

pyright - Published 1.1.201

Published by erictraut almost 3 years ago

Enhancement: Added code to detect except clauses that are unreachable because their exception types are already handled by previous except clauses.

Enhancement: Added type validation for custom metaclass keyword parameters specified in the metaclass's __new__ method.

Enhancement: Added type validation logic for dataclass __post_init__ method.

Bug Fix: Fixed bug that results in false positive error when class declaration arguments are evaluated out of order.

Enhancement: Updated typeshed stubs to the latest version.

Enhancement: Added support for Required and NotRequired type annotations in alternative syntax form of TypedDict.

Behavior Change: Changed overload implementation consistency check so it doesn't require the implementation to include a NoReturn if one of the overload signatures returns a NoReturn.

Bug Fix: Fixed a bug that resulted in a false positive in the overlapping overload check, specifically when a later overload used a type variable in a parameter annotation.

Enhancement: Added type checking support for functools.total_ordering.