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.99

Published by erictraut almost 4 years ago

Enhancement: Improved error messages for expected TypeDicts. (Contribution from Sam Abey.)

Bug Fix: Fixed bug where an *args or **kwargs parameter could be specified by name in a function call.

Behavior Change: Changed behavior of kwargs parameter that has a generic (TypeVar) type annotation. Literals are now stripped in this case before assigning to the TypeVar.

Enhancement: Improved mechanism for overloaded __init__ method that uses self parameter annotation to specify the result of a constructor. The new mechanism supports generic type arguments within the self annotation.

Bug Fix: Fixed bug that caused sporadic errors when modifying the builtins.pyi stub file.

Bug Fix: Fixed bug with overlapping overload detection. It was reporting an incorrect overlap when a different TypeVar (bound vs unbound) was used in two overloads.

Bug Fix: Fixed another false positive error related to overlapping overload methods with a TypeVar in a parameter annotation.

Bug Fix: Fixed bug that caused internal stack overflow when attempting to assign a class to a protocol that refers to itself.

Enhancement: Improved support for protocol matching for protocols that include properties. Getter, setter and deleter methods are now individually checked for presence and type compatibility, and generics are now supported.

Enhancement: Updated to latest typeshed stubs.

pyright - Published 1.1.98

Published by erictraut almost 4 years ago

New Feature: Added new diagnostic rule "reportUnusedCoroutine" that reports an error if the result returned by an async function is not consumed (awaited, assigned to a variable, etc.). This detects and reports a common error when using async coroutines.

Enhancement: Improved error messages for invalid type annotation syntax usage.

Enhancement: Updated to the latest typeshed stubs.

Bug Fix: Fixed recent regression in error message for bound TypeVars that resulted in a confusing message.

Bug Fix: Fixed bug in error messages for parameter type incompatibility; reported parameter number off by one leading to confusing message.

Bug Fix: Fixed bug in type compatibility logic when the destination was a metaclass instance and the dest was a class that derived from that metaclass.

Bug Fix: Fixed bug that caused failure in protocol type matching when the protocol contained a method with an annotated "self" parameter.

Behavior Change: If a class derives from a protocol class explicitly, individual members are no longer type-checked. This improves performance of type evaluation in some cases.

Bug Fix: Fixed bug whereby the presence of a __getattr__ method on a class with no __init__ method generated an incorrect error when instantiating the class.

Enhancement: Implemented complete support for module-level __getattr__ functions as described in PEP 562.

Behavior Change: Eliminated restriction that prevented the analysis of text files that don't end in ".py" or ".pyi".

pyright - Published 1.1.97

Published by erictraut almost 4 years ago

Enhancement: Improved type analysis performance in cases where an expression contains deeply-nested expressions that involve calls to overloaded functions or bidirectional type inference.

Bug Fix: Fixed bug in ParamSpec logic that affected the case where a generic function with specialized parameters was matched to the ParamSpec.

Bug Fix: Fixed bug where a union with a NoReturn subtype could have been generated when evaluating a union of iterable types.

Enhancement: Improved type narrowing logic for "a is b" narrowing in the case where b is a union that contains both literal and non-literal subtypes.

Enhancement: Added error condition for the situation where an overloaded function is used in conjunction with a ParamSpec.

Bug Fix: Fixed bug that resulted in a false negative error when performing type assignment checks for functions that contain unspecialized type variables.

Enhancement: Improved error messages that include type variables. The scope that defines the type variable is now included. This avoids confusing and seemingly-contradictory error messages like "type _T cannot be assigned to type _T".

Bug Fix: Fixed bug that caused type evaluator to generate different results if someone hovered over the name of a type variable within an index expression before the entire source file was analyzed.

pyright - Published 1.1.96

Published by erictraut almost 4 years ago

Enhancement: Updated typeshed stubs to the latest.

Behavior Change: Switched to LSP-native progress reporting rather than using custom progress reporting messages.

New Feature: Added a new diagnostic rule called "reportInvalidTypeVarUse" that flags errors when TypeVars are used incorrectly. In particular, it flags the use of a single instance of a TypeVar within a generic function signature.

Bug Fix: Fixed assertion (and associated crash) that results when an LS client asks the language server to open a non-Python file (i.e. one whose file name doesn't have a ".py" or ".pyi" extension). The server now ignores such requests rather than crashing.

Enhancement: Enhanced ParamSpec mechanism to support parameters that have default values.

Bug Fix: Fixed issue with variable expansion for environment variables used within settings.

Enhancement: Improved error message for yield type mismatch.

Performance Improvement: Added a heuristic to skip call-site return type inference if the number of arguments is above a threshold (6). This avoids long analysis times for complex unannotated functions.

Bug Fix: Fixed bug in error message for tuple size mismatches in the case where the source tuple has indeterminate length and the dest has a specified length.

Bug Fix: Fixed incorrect assertion (which manifests as a runtime crash) when assigning to a type that is a generic class with no specified type arguments.

Enhancement: Added new error for a protocol class that derives from a non-protocol base class.

Behavior Change: Changed the logic for Type vs type such that Type (the capitalized form) is always used in cases where there is a type argument (such as Type[int] or type[str]andtypeis used in cases where the non-generic classtypeis intended. This allowstypeto be used inisinstance` type narrowing.

Bug Fix: Fixed bug in function assignment logic in the case where the destination function has name-only parameters and the source has positional parameters that match those name-only parameters.

Behavior Change: Changed heuristic for when a decorator should be ignored for purposes of type checking. It was previously ignored if the application of the decorator resulted in an "Unknown" type. The new heuristic also ignores the application of the decorator if the resulting type is a union that includes an Unknown subtype. This situation occurs frequently with unannotated decorators where part of the result can be inferred but part cannot.

Bug Fix: Fixed bug that caused incorrect type evaluation when a relative import referenced a submodule with the same name as a symbol that was imported from that submodule if that submodule was later imported again within the same file (e.g. from .foo import foo, from .foo import bar).

Enhancement: Added support for protocol callable types when performing bidirectional type inference for lambda expressions.

Enhancement: Improved "isinstance" narrowing to better handle the case where the narrowed expression is a constrained TypeVar. It now preserves the constraint so the value can be assigned back to the TypeVar type.

Bug Fix: Fixed bug in "is None" and "is not None" type narrowing logic when dealing with recursive type aliases.

pyright - Published 1.1.95

Published by erictraut almost 4 years ago

Behavior Change: Changed encoding of diagnostics reported through the LSP interface. The diagnostic rule (if applicable) is now reported in the "code" field, and a URL points to general documentation for diagnostic rules.

Enhancement: Added support for type arg lists specified in a tuple expression (like Dict[(str, str)]) which is a legal way of writing type annotations.

Bug Fix: Fixed infinite recursion due to a __call__ method that returns an instance of the class that is being called.

Bug Fix: Fixed bug that caused completion suggestions not to work for member accesses when the LHS of the expression was a type specified in the form Type[X].

Bug Fix: Fixed bug that resulted in an attempt to parse and bind a native library (binary file) resulting in long latencies and out-of-memory errors.

Enhancement: Improved error message for unknown named parameters for TypeVar constructor.

Bug Fix: Fixed recent regression that causes a crash in certain circumstances when binding a method to an object or class in cases where that method doesn't have a "self" parameter but instead just has *args and **kwargs parameters.

Bug Fix: Fixed bug that resulted in incorrect reporting of unreported variables or parameters when they are accessed within argument expressions in cases where an error is detected when analyzing a call expression.

Enhancement: Expand ${env:HOME} in settings. Thanks to @ashb for the contribution.

Bug Fix: Fixed bug that generated incorrect errors when a callable type included another callable type as an input parameter and the second callable type had generic parameter types.

Bug Fix: Fixed bug that caused a false negative when a default parameter value was assigned to a parameter with a generic type annotation.

Bug Fix: Fixed bug that caused incorrect error to be reported when applying logical operators ("|", "&" or not) to enum.Flag literals.

pyright - Published 1.1.94

Published by erictraut almost 4 years ago

Bug Fix: Fixed potential source of infinite recursion in type evaluator.

Behavior Change: Changed behavior of tuples to strip literals when converting the variadic list of type arguments into a single "effective" type argument. This means the expression list((1,)) will now be evaluated as type list[int] rather than list[Literal[1]].

Bug Fix: Fixed bug in parser that generated an inappropriate syntax error when an annotated variable assignment included a star test list on the RHS with an unpack operator.

Enhancement: Added support for context managers that are designed to suppress exceptions.

Bug Fix: Fix infinite recursion in logic that maps pyi files to py files.

Enhancement: Improved source maps for better stack traces, useful for bug reports.

pyright - Published 1.1.93

Published by erictraut almost 4 years ago

Enhancement: Added support for TypeVar objects that are used outside of type annotations.

Bug Fix: Fixed bug that caused incorrect error when performing binary operations (arithmetics, comparisons, etc.) on classes that define corresponding magic methods that are instance methods. When performing the operation on the class, the magic methods in the metaclass should be used instead.

Enhancement: Added support for frozen dataclasses. Errors are now reported if a frozen dataclass inherits from a non-frozen dataclass and if an attempt is made to set the member of a frozen dataclass.

Bug Fix: Added support for "bytes" type promotions for bytearray and memoryview.

Bug Fix: Added support for static methods and class methods that are invoked on non-specialized generic classes where the arguments to the method provide sufficient context to fill in the missing class-level type arguments.

Behavior Change: Changed reportWildcardImportFromLibrary diagnostic rule so it doesn't apply to type stub files.

Bug Fix: Fixed bug that resulted in incorrect error when attempting to assign a constrained TypeVar to a union type that satisfied all of the constrained types.

Bug Fix: Added support for binary operator magic methods that operate on constrained TypeVars.

Bug Fix: Fixed the logic that determines whether a type can be assigned to another type when invariance rules are in effect - in particular when the destination is a union. Previously, the unions needed to match exactly. The new logic takes into account whether the destination union contains subtypes that are subclasses of each other.

Bug Fix: Fixed bug where None and Callable types could be assigned to "object" even when invariant rules were in effect. This allowed List[None] to be assigned to List[object].

pyright - Published 1.1.92

Published by erictraut almost 4 years ago

Bug Fix: Fixed bug in parser that resulted in the opening parenthesis ("(") in a parenthesized expression or tuple not being included in the parse node range.

Bug Fix: Fixed bug that could result in "unaccessed variable" error for variables that were referenced in argument expressions if there were other errors related to the call expression.

Bug Fix: Fixed bug in logic dealing with comment-style function annotations that resulted in spurious errors if "self" was used within an instance method that was so annotated.

Bug Fix: Fixed bug that caused errors when a hierarchy of dataclass classes used generic types for one or more dataclass members.

Bug Fix: Fixed bug in type checker where it allowed invariant type parameters to violate invariance if the destination was an "object" instance.

Bug Fix: Fixed off-by-one error in fstring parsing with debug variables that resulted in errors if the "=" was not preceded by a space.

Bug Fix: Fixed bug in logic that validates the assignment of a callable type to a generic callable when one of the parameters is another callable.

Bug Fix: Fixed bug that affected generic type aliases that included callable types.

Bug Fix: Fixed bug in bidirectional type inference logic when RHS includes call that returns a generic type. The old logic was prepopulating the type associated with that TypeVar but prevented the type from being further narrowed. This resulted in incorrect errors with argument expressions in some cases.

Enhancement: Added PEP 604 support for unions passed as the second argument to isinstance and issubclass.

Enhancement: Improved error messages for binary operations that involve a TypeVar for one of the operands.

Enhancement: Updated the reportMissingTypeArgument diagnostic check to apply to bound types in TypeVar declarations.

pyright - Published 1.1.91

Published by erictraut almost 4 years ago

Enhancement: Updated to the latest typeshed stubs.

Bug Fix: Fixed bug in fstring parser that generated "unexpected token at end of string" errors if fstring debug (introduced in Python 3.8) was used in conjunction with string-formatting syntax and there was no space between the "=" and the ":".

Bug Fix: Fixed bug that caused a spurious error when defining a property setter when the property getter had no declared return type.

Bug Fix: Fixed bug in isinstance narrowing logic where it didn't properly preserve a TypeVar in the negative ("else") case.

Bug Fix: Fixed bug in type narrowing logic for member access expressions like "a.b.c". A narrowed type needs to be abandoned if any part of the expression is reassigned (e.g. a.b = ).

Bug Fix: Fixed bug that resulted a "Never" type appearing as a type argument in an inferred function return type. "Never" should never be used as a type argument. It is now replaced by "Unknown" if it ever does appear.

Bug Fix: (from pylance): Fixed completion case where the completion item said one method, but hover said another once inserted.

Bug Fix: (from pylance): Reuse existing imports for auto-imports (e.g. if import os.path is present, join will use os.path.join).

pyright - Published 1.1.90

Published by erictraut almost 4 years ago

Enhancement: Added support for type() call when argument contains a generic class instance.

Enhancement: Improved reportIncompatibleMethodOverride diagnostic check for property overrides. It now checks for missing fget, fset, fdel methods and the overridden method types for each of these.

Enhancement: Added special-case handling of overloaded __init__ methods where the self parameter contains an annotation with a specialized version of the class. This is used in some typeshed stubs to influence the constructed object type when no additional information is available.

Bug Fix: Fixed bug in parser that resulted in incorrect errors when an unpack operator was used within an f-string expression.

Bug Fix: Fixed bug that resulted in incorrect errors when matching synthesized "cls" parameter type. This bug generally affected all TypeVars that were bound to a Type.

Enhancement: Improved type checking support for constrained TypeVars within function and class bodies. This was a significant change, so there's some risk of regressions or new false-positive errors. Please report any bugs you see.

pyright - Published 1.1.89

Published by erictraut almost 4 years ago

New Feature: Added support for new reportUnsupportedDunderAll diagnostic rule. It checks for unsupported manipulations of __all__.

New Feature: Implemented new diagnostic rule reportUnusedCallResult that checks whether a call expression's results are consumed. If the results are None or Any, no diagnostic is produced.

Enhancement: Added support for isinstance and issubclass type narrowing when "cls" or "self" parameters are used in the second argument

Bug Fix: Fixed recent regression with TypeGuard type that caused spurious error when a bool value was return from a user-defined type guard function.

Bug Fix: Fixed bug in reportIncompatibleMethodOverride diagnostic check where it incorrectly reported an error if a derived class used overload functions on an overridden method.

Bug Fix: Fixed bug that caused incorrect binding when invoking a class method through an instance.

Bug Fix: Fixed handling of recursive type annotations for variables (e.g. "int: int"). In some specific situations this is allowed if the annotation refers to a symbol in an outer scope.

Bug Fix: Fixed several bugs related to constructor type inference when the expected type contained generic types with type arguments that contained type variables defined in a context outside of the constructor's call site.

pyright - Published 1.1.88

Published by erictraut almost 4 years ago

Enhancement: This release includes a major update to TypeVar code. The type checker is now much more strict about how TypeVars are treated when analyzing the bodies of generic functions or methods within generic classes.

Bug Fix: Fixed bug in synthesis of comparison operators in dataclass. By default, these methods should not be synthesized unless order=True is passed to the @dataclass decorator.

Bug Fix: Fixed bug that caused incorrect specialization of a TypeVar when used in a descriptor class with a __set__ method.

Bug Fix: Fixed incorrectly handling of generic type alias that is defined in terms of other generic type aliases.

Bug Fix: Fixed bug that caused incorrect overload to be selected in cases where a named argument was used.

Enhancement: Improved signature help for calls to namedtuple constructor.

Bug Fix: Added support for a generic method whose "self" parameter is annotated with a bound TypeVar and is then invoked using another bound TypeVar.

Bug Fix: Improved error reporting for assignments to protocols.

Enhancement: Added support for the instantiation of a class via a constructor when the type of the class is specified as a TypeVar.

Bug Fix: Fixed inappropriate error in strict mode when a named argument for a call expression begins with an underscore.

Bug Fix: Fixed bug that results in an incorrect type when a call to a function returns a generic type and the result is assigned to a variable with a declared type that includes a union.

pyright - Published 1.1.87

Published by erictraut almost 4 years ago

Bug Fix: Fixed bug with type annotations that use a TypeVar with the new union syntax.

Behavior Change: Removed special-case code that eliminates a NoReturn from an async function.

Behavior Change: Changed behavior of NoReturn when it appears within unions. Previously, it was always filtered out of unions. It is now filtered out only in the inferred return type of a function. This allows NoReturn to be used in unions in other legitimate cases.

Bug Fix: Fixed bug that resulted in a false negative when a callable type with a kwargs parameter was assigned to a callable type without a kwargs or with a kwargs of a different type.

Enhancement (from Pylance): Changed fuzzy text matching algorithm for completion suggestions.

Bug Fix: Fixed bug whereby an assignment was not flagged as an error if the target type contains a type var and the source is concrete. This change generally makes the core type checker more strict about the use of type variables.

Enhancement: Added support for "eq" and "order" parameters in dataclass decorator as defined in PEP 557.

New Feature: Added new diagnostic rule "reportFunctionMemberAccess" that reports an attempt to access, set or delete non-standard attributes of function objects.

pyright - Published 1.1.86

Published by erictraut almost 4 years ago

Enhancement (from Pylance): Improvements to completion provider and signature help provider.

Bug Fix: Allow TypeAlias to be used prior to Python 3.10 if imported from typing_extensions.

Enhancement: Added special-case handling for magic method __class_getitem__, which is implicitly a classmethod.

Enhancement: Added support for classes that include the __class_getitem__ magic method to provide custom behaviors for subscripting.

Enhancement: Support detecting multiple site-packages directories in venvs. [Contribution by Truls Asheim]

Bug Fix: Fixed bug that caused incorrect type errors when dealing with magic methods on the tuple class.

Bug Fix: Fixed a confusing diagnostic message relating to incorrect method override.

Enhancement: Enforced that TypeVars being solved for in a TypeVar map match the expected scope.

Bug Fix: Fixed bug in synthesized setdefault method on TypedDict for required entries, which never use the default value.

Bug Fix: Fixed bug that resulted in an inappropriate error when a kwarg parameter was typed with a class-defined TypeVar (e.g. **kwargs: _VT).

Bug Fix: Made the check less strict for the use of covariant type vars within a function input parameter annotation. In particular, unions that contain covariant type vars are now permitted.

Enhancement: Add future module as import suggestion. [Contribution by cdce8p]

Bug Fix: Fixed bug that caused the issubtype type narrowing logic to fail when used with a bound TypeVar T in combination with Type[T].

Bug Fix: Don't add suggestions for 'with Y as [ ]'. [Contribution by cdce8p]

Enhancement: Type aliases are now expanded in completion provider text in the same way as the hover text. [Contribution by cdce8p]

Enhancement: Improve handling of type aliases for auto-import. [Contribution by cdce8p]

pyright - Published 1.1.85

Published by erictraut almost 4 years ago

Behavior Change: Changed diagnostic about first argument to super call to be part of the reportGeneralTypeIssues diagnostic rule so it is suppressed when type checking mode is set to "off".

Bug Fix: Fixed bug that caused code within finally clause to be marked as unreachable if there was no except clause and the code within the try block always raised an exception.

Bug Fix: Fixed bugs in ParamSpec logic. It was not properly handling the case where the target callable type contained keyword-only or positional-only parameter separators.

Bug Fix: Added support for tuple and type subscripts when __future__ annotations is defined.

Bug Fix: Fixed bug that caused improper errors when using new-style union syntax with from __future__ import annotations.

Bug Fix: Worked around a reported bug in node 14+ on Linux where calls to fs.watch throw an exception when creating a recursive file watcher. The workaround is to catch the exception and proceed without a file watcher in place.

Enhancement: Updated typeshed stubs to the latest.

pyright - Published 1.1.84

Published by erictraut almost 4 years ago

Bug Fix: Fixed parser crash when an f-string contained an empty expression.

Bug Fix: Fixed bug that caused diagnostics with "information" severity to be reported as "warnings" in the CLI version of pyright.

Bug Fix: Fixed recent regression in handling type evaluations for "and" and "or" operators. Short-circuiting evaluation was not handled correctly in some cases.

Bug Fix: Fixed bug in parser that caused expressions within f-strings to be handled incorrectly if they contained syntax errors.

Bug Fix: Fixed bug in parsing of annotated variable assignments. It was not allowing yield expressions on the right-hand side.

Enhancement: Added special-case logic to handle isinstance call when the first argument is a TypedDict and the second argument is a dict class. A TypedDict does not derive from dict from the perspective of type checking, but at runtime, isinstance returns True. This affects both type narrowing logic and checks for unnecessary isinstance calls.

Bug Fix: Fixed bug in type narrowing logic for expressions of the form "type(x) is y" or "type(x) is not y". The logic was incorrectly narrowing the type in the negative ("else") case. And in the positive case, it was not properly handling cases where x was a subclass of y.

Bug Fix: Fixed bug that caused completion suggestions to be presented when typing a period within a comment on the first line of the file.

Enhancement: Improved signature help for data classes where default values are specified.

Bug Fix: Fixed bug in NamedTuple logic that caused spurious errors when attempting to assign a NamedTuple to a Tuple with a compatible set of type arguments.

pyright - Published 1.1.83

Published by erictraut almost 4 years ago

Bug Fix: Fixed bug in perf optimization for set, list, and dictionary type inference. The old code was failing to evaluate expressions associated with entries beyond 64, which meant that tokens were not classified correctly and type errors in these expressions were not reported.

Bug Fix: Do not report errors for union alternative syntax (PEP 604) if evaluation of type annotation is postponed (either in a quote or via PEP 563).

Bug Fix: Fixed bug that caused spurious errors when evaluating type annotations within certain circumstances.

Bug Fix: Fixed bug that sporadically caused incorrect and confusing type errors such as "list is incompatible with List".

Bug Fix: PEP 585 says that it should be possible to use type in place of Type within type annotations. Previously, this generated an error.

Behavior Change: Changed re-export logic for type stub and py.typed modules to honor the clarification that was recently added to PEP 484. Previously, any import that used an "as" clause was considered to be re-exported. Now, symbols are re-exported only if the "as" clause is redundant (i.e. it is of the form import A as A or from A import X as X).

Bug Fix: Fixed inconsistency in handling of imported symbols that have multiple untyped declarations within the target module. The inconsistency was between the two cases import x, x.y and from x import y. In the latter case the type resolution logic considered only the last symbol declaration in the target module, but in the former case it was considering all declarations and returning the union of all types.

Bug Fix: Fixed bug in f-string parsing. It was generating an error for comma-separate list of expressions, which is legal.

Bug Fix: Fixed inconsistency in type narrowing for isinstance and issubclass calls. Previously, the narrowing logic used the target class(es) if the source expression was of type Any but did not do the same when the source expression was a union type that included Any but all other subtypes were eliminated.

Bug Fix: Added logic for or and and operators to handle the case where the left-hand operand is always falsy (in the case of or) or always truthy (in the case of and).

pyright - Published 1.1.82

Published by erictraut almost 4 years ago

Bug Fix: Fixed internal error that occurs when the type evaluator encounters a circular dependency between a class decorator and the class that it decorates.

Bug Fix: Fixed bug in protocol matching logic that results in incorrect errors indicating a function type mismatch.

Perf Improvement: Conditionalized the logic for the reportPropertyTypeMismatch diagnostic check. It's somewhat expensive, so don't bother executing it if it's disabled.

Perf Improvement: Fixed performance regression introduced along with user-defined type guards.

Enhancement: Added support for reverse logical operators (__ror__, __rand__, etc.).

Bug Fix: Added code to handle the case where a class has a custom metaclass that handles logical or (the __or__ method). Previous to this change, use of an | operator with classes was assumed to be a misuse of PEP 614 in Python versions prior to 3.10.

Bug Fix: Fixed bug that resulted in an incorrect error when a list comprehension expression was used within a lambda and the expression referenced one or more of the lambda parameters.

Bug Fix: Fixed bug that caused incorrect error to be reported for names referenced in global and nonlocal statements when those names were not declared in the outer scope.

Bug Fix: Fixed bug that resulted in incorrect error when second argument of isinstance was a "type" or "Type" object.

pyright - Published 1.1.81

Published by erictraut almost 4 years ago

Bug Fix: Fixed bug in parser that caused incorrect errors in chains of comparison or "in"/"not in" operators. The expression "a == b == c" should be parsed as "a == (b == c)", but the code was previously parsing it as "(a == b) == c". This didn't matter in most cases, but it does when the types of a, b and c differ.

Bug Fix: Fixed bug that resulted in incorrect errors when an instance variable with no type declaration was assigned an enum value. It was assumed to be of that literal enum value type rather than the wider enum type.

Bug Fix: Fixed bug that resulted in false positive error when a class derived from another class that was instantiated from a custom metaclass.

Bug Fix: Fixed bug that caused type errors when internal type cache was cleared. The code previously used parse node IDs to distinguish between types that are not created via class declarations (NamedTuple, type, NewType, etc.). Since node IDs change when a file is reparsed (due to a change), these IDs cannot be relied upon for type comparisons.

Enhancement: Added support for "typing" module aliases when checking for TYPE_CHECKING symbol in static boolean expressions.

Behavior Change: Removed recently-added "reportInvalidTypeVarUse" diagnostic rule and associated checks. After further discussion, we decided that there are legitimate cases where a TypeVar can appear only once in a function signature.

pyright - Published 1.1.80

Published by erictraut about 4 years ago

Bug Fix: Fixed bug that caused an incorrect error when self.__class__ was used as the second argument to an isinstance call.

Bug Fix: Changed logic for function return type inference so "unbound" type is never propagated to callers. This eliminates incorrect and confusing errors.

Bug Fix: Fixed bug in type stub generator. It was not properly handling annotated variables (either those with PEP 593 annotations or older-style type comment annotations).

Bug Fix: Fixed bug in completion provider that caused submodules within a namespace module not to be suggested within a "from x import y" statement.

Bug Fix: Fixed misleading error message within "from x import y" statement where x was a namespace package and y was not found. The error was being reported as an "unresolved import x" rather than "unknown symbol y".

Bug Fix: Fixed bug in type evaluator that caused spurious errors related to variables used within "for" and "if" statements within a comprehension.

Bug Fix: Fixed bug that caused incorrect error to be reported when a recursive type alias was used in certain circumstances.

Enhancement: Improved type inference for tuples in circumstances where literals are used within a tuple expression and when tuple expressions are assigned to an expected type that is not a tuple but is a compatible type (such as Iterable).

Bug Fix: Fixed bug that resulted in incorrect error about TypeVar being used incorrectly. The specific condition was when it was referenced within a method within a generic class and one of the method's parameters also referenced the same TypeVar.

Bug Fix: Fixed bug where declared variable with literal types in type arguments were being stripped of those literals when the variable was exported from a module.

Bug Fix: Fixed bug that caused duplicate error messages involving certain TypeVar assignments.

Enhancement: Added diagnostic check for dictionary unpack operator (**) if the operand is not a mapping object.

Enhancement: Added new diagnostic rule "reportInvalidTypeVarUse" that controls reporting of TypeVars that appear only once in a function signature. By default it is off in basic type checking mode but on in strict mode.

Enhancement (from Pylance): Added support for increment text changes in language server interface. This will theoretically improve performance for edits in large source files.