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

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in type evaluator that caused some diagnostics to be suppressed unintentionally and in a non-deterministic manner (based on the order in which types were evaluated).

Enhancement: Added a heuristic to disable the "implied else" analysis if the code is within a function that has no input parameter annotations. This mitigates the performance overhead of "implied else narrowing".

Enhancement: When a function decorator is applied and the decorator returns a function that has no docstring, copy the docstring from the decorated function.

Enhancement: Changed inference logic for constructors to allow synthesized type for cls to retain its generic form when instantiated, so the expression cls() will remain generic.

Bug Fix: Fixed false positive "metaclass conflict" error that occurs when the metaclass has an unknown class type in its class hierarchy.

Bug Fix: Fixed bug in type evaluator when dealing with a bound TypeVar. The constraint solver wasn't properly handling the Type[T] statement in all cases.

Bug Fix: Fixed recent regression in CLI where partial stub packages were not applied correctly.

Enhancement: Eliminate duplicate python search paths, eliminating the need to search the same path more than once on every import resolution.

Bug Fix: Fixed crash in logic that handles partial type stub merging. The crash occurs when a search path points to a file (e.g. a zip file) rather than a directory.

Enhancement: Added support in PEP 646 when the unpacked TypeVarTuple is not at the end of the type parameter list. This allows for suffixing when matching type arguments against type parameters and when matching TypeVarTuple parameters in a Callable.

Enhancement: Added better error reporting for reveal_type and reveal_locals calls.

Enhancement: Added file system caching to import resolver for performance reasons.

Bug Fix: Fixed bug in type-printing logic for tuples. When typeCheckingMode is "off", type arguments are supposed to be displayed if they are not all "Any" or "Unknown", but they were omitted always.

Bug Fix: Fixed bug that caused type evaluation behavior that depends on (including, possibly, false positive errors) when evaluating subexpressions within a case statement.

Enhancement (from Pylance): Fix HTML escaping in code blocks.

Behavior Change: Exempt ParamSpec from "single use of TypeVar within function signature" check.

Enhancement: Improved error reporting for ParamSpec misuse.

pyright - Published 1.1.118

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in logic that verifies exception type in "raise" statement. It was not properly handling generic types that were bound to BaseException.

New Feature: Add --ignoreexternal CLI flag for use with --verifytypes feature. (Contribution by Vlad Emelianov)

Enhancement: The --verifytypes output now includes file paths in the report. (Contribution by Vlad Emelianov)

Bug FIx: Fixed crash that occurred when a function was declared within a local scope but when the function's symbol was previous declared "global" or "nonlocal" within that scope.

Enhancement (from Pylance): Method and class docstrings now inherit from parent classes if docstrings are missing in child class.

Enhancement (from Pylance): Improved support for partial stubs (where py.typed file includes "partial" as per PEP 561).

Bug Fix: Fixed bug that caused incorrect type evaluation for member access expressions when the member was a descriptor object and the base type was a variable containing a reference to the class.

Bug Fix: Fixed bug in document symbol provider that caused incorrect range to be returned for classes and functions.

Enhancement: Improved tracking of incomplete types (those that have not yet been fully established because of recursive type dependencies within the code flow graph).

New Feature: Added logic for if/elif chains that contain no else clause but completely narrow one or more variables.

Behavior Change: Changed behavior of TypeVar constraint solver to eliminate literal types (widening them to their associated type) when solving for TypeVars, unless a literal type was explicitly provided (e.g. using explicit specialization like List[Literal[1, 2, 3]]).

Behavior Change: Changed reportOverlappingOverload to be an error in strict mode.

Bug Fix: Fixed bug in logic that determines whether one callable type can be assigned to another. It wasn't taking into account the positional-only parameter separator (/).

Bug Fix: Fixed a bug in conditional type narrowing that narrows based on descriminated member variable types. It was being over aggressive in narrowing in the negative ("else") case when the type of the member was a union of literal types.

Bug Fix: Fixed false positive error that occurred when setting or deleting the member of an object where that member's type is defined by a parent class and is generic but is specialized by a child class.

pyright - Published 1.1.117

Published by erictraut over 3 years ago

Enhancement: Extended check that detects redeclared functions and methods to also report redeclared properties within a class.

Bug Fix: Fixed crash in parser that occurs when malformed index expression is parsed.

Enhancement: Improved error message for certain type incompatibilities.

Bug Fix: Fixed bug in logic that determines whether a function type is assignable to another function type. It was not properly handling the case where the destination had a **kwargs parameter and the source had an unmatched keyword parameter.

Enhancement: Added new check to ensure that the type signature of a function with overloads is the superset of all of its overload signatures.

Enhancement: Improved consistency of error messages by standardizing on "incompatible" rather than "not compatible".

Bug Fix: Fixed bug in handling of type(x) call that resulted in false positive errors.

Behavior Change: Changed the logic that determines whether a variable assignment is an implicit type alias definition. If there is an explicit type annotation (other than the use of the PEP 612 TypeAlias), it is no longer considered a type alias. This is consistent with the rules mypy uses.

Bug Fix: Fixed a bug in the logic for inferring "cls" parameter that resulted in incorrect type evaluations.

Enhancement: Added check to detect inappropriate use of variables (that are not type aliases) within type annotations.

Bug Fix: Fixed bug in type compatibility logic that permitted a type of Type[Any] to be assigned to type None.

New Feature: Implemented support for PEP 655: Marking individual TypedDict items as required or potentially-missing. This PEP is still under development, so the spec could change.

pyright - Published 1.1.116

Published by erictraut over 3 years ago

Enhancement: Improved type inference logic for tuple expressions that contain unpacked tuples.

Bug Fix: Fixed bug that resulted in unknown types within stubs when a forward reference was made within a type alias definition.

Bug Fix: Fixed bug in bidirectional type inference logic for unpack operator.

Bug Fix: Fixed bug in assignment type narrowing for index expressions. The narrowed type was always evaluated as "None" rather than the assigned type.

Bug Fix: Fixed bug in assignment type narrowing that was triggered when the RHS and LHS were both union types and the RHS contained an Any.

Enhancement: Added diagnostic check for a call expression that appears within a type annotation. This was previously not flagged as an error.

Bug Fix: Fixed false negative bug in the "reportOverlappingOverload" diagnostic check. It was not correctly detecting overlapping overloads when one of the parameters in the earlier overload was annotated with at TypeVar.

Bug Fix: Fixed bug in logic that compares the type compatibility of two functions. In particular, if the source function contains a keyword argument and the dest function does not contain a keyword argument of the same name bug contains a **kwargs, the types must match.

Enhancement: Added support for overloaded __init__ method that annotates the self parameter with a generic version of the class being constructed.

Behavior Change: Added a few exemptions for the reportInvalidTypeVarUse check. In particular, constrained TypeVars, bound TypeVars used as type arguments, and any TypeVar used as a type argument to a generic type alias are exempt from this check. There are legitimate uses for all of these cases.

Bug Fix: Fixed recent regression in type assignment check logic that broke certain cases where the destination and source were both unions that contained type variables.

Behavior Change: Changed behavior when evaluating type of symbol within type stubs. Previously forward references were allowed only for class types. Now, forward references are allowed (and no code flow analysis is employed) for all symbols. The new behavior is consistent with mypy's.

Enhancement: Added new diagnostic check for an overloaded function without an implementation within a source (.py) file. Fixed a bug in the diagnostic check for a single overload when an implementation is present.

Bug Fix: Fixed bug in the parsing of "with" statements where the "with item" starts with an open parenthesis.

Enhancement: Added "collections.defaultdict" to the list of classes that does not support runtime subscripting in versions of Python prior to 3.9.

Behavior Change: Changed behavior of type inference for empty list ([]) and empty dict ({}) expressions. They were previously inferred to be List[Any] and Dict[Any, Any], but they are now inferred as List[Unknown] and Dict[Unknown, Unknown]. This affects strict mode type checking, where partially-unknown types are reported as errors. This change may require some explicit type annotations within strictly-typed code.

pyright - Published 1.1.115

Published by erictraut over 3 years ago

Bug Fix: Fixed false positive bug where "class not runtime subscriptable" error was reported even if in a type stub.

New Feature: Implemented command-line switches for pythonplatform and pythonversion. These are overridden by pyrightconfig.json settings.

New Feature: Added support for comments and trailing comments within pyrightconfig.json.

Enhancement: Updated to latest typeshed stubs.

Enhancement (from Pylance): Improve auto-import performance.

Enhancement (from Pylance): Added extra perf tracking.

Bug Fix: Fixed false positive error that incorrectly complained about the use of Annotated as a class with no type arguments.

Bug Fix: Fixed false positive error when using bidirectional inference of dictionary expression where the expected type key and/or value types contain literals.

Bug Fix: Fixed bug that resulted in wildcard imports (i.e. imports the form from x import *) to import symbols from the target that were not meant to be externally visible. This bug occurred only when the imported module had no __all__ symbol defined.

Bug Fix: Fixed bug in validation of constrained types in TypeVars. Subtypes of constrained types should be allowed.

pyright - Published 1.1.114

Published by erictraut over 3 years ago

Enhancement: Improve source mapper (the code that maps symbols found in stub files to the corresponding code in ".py" files) to handle more cases.

Enhancement: Added diagnostic error for try statement that has no except or finally statement.

New Feature: Added "reportOverlappingOverload" diagnostic rule, splitting out a few checks that were previously in the "reportGeneralTypeIssue" rule. This allows for finer-grained control over these overload checks.

Behavior Change: Added a few additional names that can be used for "cls" parameter without triggering diagnostic. These variants are reasonable and are used within some typeshed stubs.

Enhancement: Added TypeVarTuple definition to typings.pyi stub.

Enhancement: Updated TypeVarTuple logic to detect and report an error when a tuple of unknown length is bound to an unpacked TypeVarTuple. This is illegal according to the latest version of PEP 646.

Enhancement: Special-cased the __init_subclass__ method in the completion provider so it is offered as a suggestion even though there is no @classmethod decorator present. This symbol is unfortunately inconsistent from all other class methods in that it doesn't require a @classmethod decorator for some reason.

Behavior Change: Changed logic for attributes marked ClassVar to allow writes from an instance of the class as long as the type of the attribute is a descriptor object.

Bug Fix: Fixed a hole in type comparison logic for TypeVars that could have theoretically resulted in incorrect aliasing of types.

Bug Fix: Fixed bug that caused false positive when import statement targeted a symbol that had a nonlocal or global name binding.

Behavior Change: Enhanced method override compatibility logic to allow instance and class methods to pass generic bound types for self and cls.

New Feature: Added support for ".pth" files (often used for editable installs) when using the "venv" configuration option in pythonconfig.json.

Bug Fix: Fixed bug whereby import symbol “A” in the statement “from . import A” was not considered a public symbol in a py.typed source file, but it should be.

Enhancement: Improved handling of enum classes. If such a class is defined in a ".py" file, variables defined in the class with type annotations but no assignment are now considered instance variables within each enum instance, whereas variables assigned within the enum class are assumed to be members of the enumeration. This is consistent with the way the EnumMeta metaclass works. In stub files, type annotations without assignments are still assumed to be members of the enumeration, since that's the convention used in typeshed and other stubs.

Enhancement: Added check for parameter names when comparing functions. Parameter names that do not begin with an underscore must match in name. This also affects method override checks and protocol matching checks.

Bug Fix: Fix potential infinite recursion in source mapping, crash in doc strings

pyright - Published 1.1.113

Published by erictraut over 3 years ago

Bug Fixes: Improved support for PEP 634 (Structured Pattern Matching):

  • Improved negative-case type narrowing for capture patterns. Because capture patterns capture anything, the remaining type is "Never".
  • Improved type narrowing for mapping patterns used in structural pattern matching when the subject expression type contains a typed dictionary.
  • Added code to detect and report cases where irrefutable patterns are used within an "or" pattern and are not the last entry.
  • Added logic to verify that all "or" subpatterns target the same names as specified in PEP 634.
  • Added code to detect the case where a case statement without a guard expression uses an irrefutable pattern but is not the final case statement. This is disallowed according to PEP 634.
  • Fixed bug in parser that resulted in incorrect text ranges for parenthetical patterns.

Bug Fix: Improved performance for completion suggestions, especially when large numbers of suggestions are returned.

Enhancement: Updated typeshed stubs to the latest.

Enhancement: Enabled postponed type annotation evaluation by default for Python 3.10.

Bug Fix: Fixed bug that caused a false positive when a bound TypeVar was used to access a class method that was annotated with a bound TypeVar for the "cls" parameter.

Bug Fix: Fixed bug that caused index expressions to be printed incorrectly when they appeared in error messages.

Enhancement: Added type narrowing support for index expressions that use a numeric (integral) literal subscript value.

Enhancement: Improved the logic that determines whether a call expression within the code flow graph is a "NoReturn" call. It now provides better handling of unions when evaluating the call type.

Enhancement: Added support for parenthesized list of context managers in "with" statement for Python 3.10.

Bug Fix: Fixed bug that prevented the use of a generic type alias defined using a PEP 593-style "Annotated" with a bare TypeVar.

pyright - Published 1.1.112

Published by erictraut over 3 years ago

Bug Fix: Fixed false negative when PEP 585 type is used in a type alias or other cases where postponed evaluation is not possible.

Bug Fix: Fixed regression that resulted in error when "match" is used in expressions but is mistaken for a pattern-matching statement.

Bug Fix: Fixed schema for "python.analysis.logLevel" setting. The default value was specified incorrectly. Thanks to Rafał Chłodnicki for this fix.

Bug Fix: Fixed a bug that caused a false positive when a TypeVar is bound to a generic protocol class.

Bug Fix: Fixed a bug that caused a false positive when a boolean operator was applied to a type variable and the corresponding magic method used an explicit type annotation for the "self" parameter.

Enhancement: Added a new diagnostic check for out-of-range indexes for tuples that have known lengths.

Enhancement: Added limited support for negative type narrowing in pattern matching. For example, if the type of the subject expression is bool and the matching pattern is False | x, the type of x will be inferred to be True.

Bug Fix: Fixed bug that affected generic type aliases that contained Callable types that are parameterized by a type variable.

Enhancement: Extended abstract method checks to Protocol classes even though they don't explicitly derive from ABCMeta.

Bug Fix: Fixed bug in type narrowing for class patterns in "case" statements.

pyright - Published 1.1.111

Published by erictraut over 3 years ago

New Feature: Implemented PEP 634 support for structural pattern matching. This new PEP was just accepted, and the functionality will appear in the next alpha release of Python 3.10.

Bug Fix: Fixed bug that caused a false positive error when declaring a class within a local scope when the symbol is nonlocal or global.

Enhancement: Improved handling of unpacked arguments when the type is a union of known-length tuples.

pyright - Published 1.1.110

Published by erictraut over 3 years ago

Bug Fix: Fixed a bug in isinstance type narrowing logic where the type of the second argument to isinstance is type Type[T] and the first argument is a union of types that includes type T.

Enhancement: Expanded reportUnusedCallResult diagnostic check to also check for expressions of the form await .

Bug Fix (from Pylance): Changed language server to set the working directory before attempting to execute script to retrieve sys.paths.

Behavior Change (from Pylance): Separated behavior of "go to definition" and "got to declaration". The former tries to take you to the source, whereas the latter takes you to the stub file.

Bug Fix: Changed binding logic to not assume that an assignment to a simple name can generate an exception. This fixes a reported false positive error in a type narrowing case.

Enhancement: Added proper error check for the use of an unpack operator (*) when used outside of a tuple.

Bug Fix: Avoid generating a diagnostic for reporUnknownMemberType if the member access expression is used as a call argument and is a generic class that is missing type arguments. This case was already special-cased for reportUnknownArgumentType to handle common cases like isinstance(x, list), but it was resulting in errors for isinstance(x, re.Pattern).

Bug Fix: Fixed a hole in the detection of unspecified type arguments for the Tuple and tuple classes.

Enhancement: Added support for generic classes that are parameterized by ParamSpecs, as allowed in PEP 612.

pyright - Published 1.1.109

Published by erictraut over 3 years ago

Enhancement: Added some performance optimizations to handle cases where there are many overloads for a function (>100). Previous code hit n^2 analysis times where n is number of overloads.

Enhancement: Added perf optimization that avoids reallocation of special form classes (like Protocol and Literal) every time they're used. Since instance of the type is now cached and reused.

Enhancement (from Pylance): Improved formatting of docstrings in hover text, completion suggestions, and signature help.

Enhancement (from Pylance): Added better performance metrics.

Bug Fix (from Pylance): Improved logic to ignore temp files created by code formatters like black.

Bug Fix: Fixed "possibly unbound" false positive error in try/except/else/finally statement in the special case where a "bare except" clause is used.

Bug Fix: Replaced logic that detects whether a function's inferred type is "NoReturn" — and specifically whether its implementation is a "raise NotImplementedError". The old logic depended results that varied depending on the order in which types were evaluated and was therefore nondeterministic.

Bug Fix: Fixed false negative where type expressions used as arguments to TypedDict or NamedTuple constructors are not correctly checked for incompatibility with older versions of Python when they contain | or use PEP 585 types.

Behavior Change: Changed PEP 585 violations (e.g. using list[int] rather than List[int]) to be unconditional errors rather than diagnostics controlled by reportGeneralTypeIssues diagnostic rule. That way, they appear even when type checking is disabled.

Bug Fix: Reverted recent change in for/else statement logic because it introduced a regression.

Behavior Change: Changed the reportUnboundVariable default severity from "warning" to "none" when typeCheckingMode is "off". There were too many complaints of false positives from users who have no interest in type checking.

Enhancement: When a redundant form of a from .. import statement is used (e.g. from x import foo as foo), always mark the imported symbol as accessed because it is assumed that it is being re-exported.

Bug Fix: Fixed bug that caused incorrect type evaluation when a return type in a generic function used a Callable with Concatenate and a ParamSpec.

Bug Fix: Fixed bug in code that prints types (e.g. in error messages and hover text) that resulted in duplicate types in a union when typeCheckingMode was "off".

Enhancement: Updated code that prints function types (e.g. for error messages and hover text) to include unioned return types in parentheses to distinguish between () -> (int | str) and () -> int | str.

Bug Fix: Fixed formatting of usage text in CLI. Fix contributed by @fannheyward.

Bug Fix: Fixed bug that caused problems when the type ellipsis was used in a type stub instead of ....

Bug Fix: Fixed recent regression in handling of isinstance second parameter.

pyright - Published 1.1.108

Published by erictraut over 3 years ago

Behavior change: Changed type inference logic for binary expressions of the form x or [] so [] uses the type of x to inform its type.

Bug Fix: Fixed bug in the way a specialized variadic type alias is printed (for error messages, hover text, etc.).

Enhancement: Added support for subscript index lists that contain a trailing comma (e.g. a[0,]). The subscript in this case is a tuple and is not valid for most objects, so it should generate an error.

Enhancement: Improved parse error recovery for empty subscripts (e.g. a[]). Started to add support for PEP 637.

Enhancement: Improved consistency of error messages.

New Feature: Added support for PEP 637 (keyword and unpacked arguments in subscripts). This PEP is still in the draft phase and may change before being finalized.

New Feature: Added a way for the "verifytypes" feature to ignore partially-unknown types imported from external packages. To use this feature, append a "!" to the end of the package name provided after the "--verifytypes" option.

pyright - Published 1.1.107

Published by erictraut over 3 years ago

Bug Fix: Fixed cyclical type resolution with TypeVar.

Behavior Change: Updated typeshed stubs to new directory layout.

Bug Fix: Fixed false positive error in try/except/finally statement. Call expressions are now assumed to possibly result in raised exceptions, and finally clauses are assumed to be exception targets.

Bug Fix: Fixed regression in import resolution where the first portion of the import path matches multiple namespace packages.

New Feature: Added initial support for PEP 646 (variadic type variables). This PEP is still in the draft stage and is likely to change before it is ratified.

Enhancement: Added check for duplicate keyword arguments that map to **kwargs parameter.

Enhancement: Added support for class properties, which are now supported in Python 3.9.

Behavior: Eliminated false positive errors for unbound variables that are targets of a for loop iterator and used after the for loop. This change can result in some false negatives.

pyright - Published 1.1.106

Published by erictraut over 3 years ago

Bug Fix: Added missing check for empty f-string expression.

Bug Fix: Fixed a bug that resulted in incorrect bidirectional type inference when the source was a call to a constructor and the destination (expected) type was a recursive type alias that includes a union with only some subtypes that match the constructed type.

Bug Fix: Fixed two issues in the import resolution logic. First, it was returning a namespace module if it found one in the workspace path or extraPaths even if a traditional (non-namespace) module satisfied the import from the sys.path. The interpreter searches all paths and always prefers a traditional module if it can find it. Second, it was resolving a namespace module if a traditional module only partially resolved the import path. The real interpreter always prefers a traditional module even if it partially resolves the path (in which case the full import fails).

Behavior Change: When too few type arguments are provided for a generic class specialization, this diagnostic is now handled via reportGeneralTypeIssues rather than reportMissingTypeArgument. The latter is reserved for cases where type arguments are omitted completely.

Enhancement: Improved type narrowing logic for isinstance and issubclass so they better handle the case where the class passed in the second argument is a type variable.

pyright - Published 1.1.105

Published by erictraut over 3 years ago

Enhancement: Added missing check for ** used in argument expressions. The expression after the ** must be a mapping with str keys.

Enhancement: Added missing check for a name-only parameter appearing in a signature after a "*args: P.args" ParamSpec parameter.

Enhancement: Improved error message for non-keyword parameter that follows a "*" parameter.

Enhancement: Added missing check for positional argument count when a simple positional argument appears after a *args argument.

Enhancement: Added missing checks for illegal usage of positional parameters when calling a function defined with ParamSpec and Concatenate.

Enhancement: Added missing check for use of keyword arguments in a call to an inner function that uses P.args and P.kwargs defined by a ParamSpec.

Bug Fix: Fixed false positive warning relating to single use of a type variable within a signature when that type variable is a ParamSpec, and it is also referenced in "P.args" or "P.kwargs" annotations.

Enhancement: Added missing PEP 612 support for functions that take a parameter with a callable type that includes a ParamSpec as well as *args: P.args and **kwargs: P.kwargs parameters.

Bug Fix: Fixed false positive error related to use of "ClassVar" when it is used in a member access expression like "typing.ClassVar".

Enhancement: Improved performance for deeply nested expressions that involve calls to overloaded functions.

Bug Fix: Fixed crash when "()" is used as a type argument for a class that doesn't accept variadic type parameters.

pyright - Published 1.1.104

Published by erictraut over 3 years ago

Bug Fix: Fixed bug in import resolver where a namespace package was chosen over a traditional package if the former had a shorter name.

Enhancement: Added support for __call__ method overloads when assigning a callable object to a callable type.

Enhancement: Added error for a subscripted type annotation that involves a quoted expression in the LHS of the subscript. This generates runtime errors.

Enhancement: Enhanced reportIncompatibleMethodOverride diagnostic check to support overrides that have *args and **kwargs parameters.

Enhancement: Improved completion suggestions to better handle super calls in base class methods.

Bug Fix: Fixed bug that affected the case where a class variable has a declared type in a base class, and a subclass assigns a value to that class variable but doesn't (re)declare its type. In this case, the type of the expression assigned within the base class should use the expected type declared in the base class for type inference.

Enhancement: Added missing error logic to handle the case where a type variable is used in the LHS of a member access expression. This isn't supported currently in the Python type system.

Enhancement: Improved error checking and reporting for NewType (for unions, literals, callables, protocol classes, and type variables).

Enhancement: Added error check for an attempt to instantiate a literal (Literal[1]()).

Bug Fix: Fixed bug in TypeVar constraint solving logic. If an "Any" or "Unknown" type is being assigned to a constrained TypeVar, it should result in "Any" or "Unknown" rather than the first constrained type.

Enhancement: Added check for multiple functions declared within the same scope that have the same name, with the final one overwriting the earlier ones. This check is suppressed for overloaded functions and property setters/deleters.

Enhancement: Improved the reportIncompatibleVariableOverride diagnostic check so it ignores symbols with private names (i.e. start with double underscores).

Bug Fix: Changed hover text to use the last declaration of a symbol rather than the first declaration to determine which type category text (e.g. "(module)" or "(class)") in the hover text.

Bug Fix: Fixed bug that caused error when invoking the definition provider on an unresolved module import.

Bug Fix: Fixed bug in logic that infers symbol types that resulted in "unbound" types to be reported incorrectly in certain rare circumstances.

Bug Fix: Fixed a crash in the "--verifytypes" feature of the CLI.

Bug Fix: Fixed bug in file watching logic so it properly handles cases where an entire folder is deleted.

pyright - Published 1.1.103

Published by erictraut over 3 years ago

Bug Fix: Suppressed "symbol is unbound" error when used in a del statement, since this is legal.

Enhancement: Enhanced --verifytypes command so it can now accept a module path within a package. Type analysis is limited to the specified module and its submodules.

Bug Fix: Fixed bug that caused "--verifytypes" feature to report missing return type annotations for all property getters within a class if only one of them was missing a return type annotation.

Enhancement: Added missing error logic to handle the case where a type variable is subscripted in a type expression. This isn't supported currently in the Python type system.

Enhancement: Improved signature help in case where right parenthesis is missing.

Enhancement: Added error for incorrect use of list expression for type arguments.

pyright - Published 1.1.102

Published by erictraut almost 4 years ago

Enhancement: Added error for Callable that is missing a return type.

Behavior Change: Changed type analysis behavior when reportGeneralTypeIssues diagnostic rule is disabled and an incompatible type is assigned to a variable. Previously, the assigned type was retained in this case, but now the declared type is assumed (as it is when reportGeneralTypeIssues is enabled).

Enhancement: Added support for completion suggestions within subscript for typed dict attribute names.

Behavior Change: Change string literals to use "constant" type when displayed in completion suggestion lists.

Behavior Change: Changed logic for detecting overrides of Final member variables by subclasses. Symbols with double underscores are now exempt from this check, since they are considered private and are name-mangled.

Bug Fix: Fixed bug in logic that detects overrides of @final methods. The logic was not handling the case where a private (single underscore) method was marked final.

Enhancement: Updated typeshed stubs to latest.

Bug Fix: Fixed regression in code that handles context managers that suppress exceptions.

Bug Fix: Fixed bug that resulted in infinite recursion (and an internal error) when NewType was used with a protocol class.

Bug Fix: Fixed reportIncompatibleMethodOverride diagnostic check so it doesn't ignore incompatible protected methods (those whose names start with a single underscore).

Enhancement: Added support for "reveal_locals()" call to reveal all of the symbols within the current scope.

Bug Fix: Fixed internal error resulting from an assignment expression located within a list comprehension scope which is contained within a class scope.

Enhancement: Augmented type completeness JSON output to include alternate public names of exported symbols. For example, if a symbol "foo" is declared in module "a.b.c" and is also re-exported from "a", then the main name of the symbol is "a.b.c.foo", but it has an alternate name of "a.foo".

Enhancement: Improved "partially unknown type" error messages within type completeness report.

pyright - Published 1.1.101

Published by erictraut almost 4 years ago

Bug Fix: Fixed false negative for "reportUnknownParameterType" diagnostic rule when all function parameters were unannotated.

Bug Fix: Fixed a couple of issues with TypeGuard. Previously, TypeGuard was implemented as an alias to bool which meant that bool was assignable to TypeGuard in all circumstances. Now it is special-cased to be assignable only in return statements.

Bug Fix: Fixed bug that caused definition provider to not fully resolve a submodule symbol in certain cases.

Enhancement: Added support for aliases of imported module "sys" when evaluating "sys.platform" and "sys.version".

Behavior Change: Suppressed "Covariant type variable cannot be used in parameter type" diagnostic in the case of an "init" method to match mypy behavior.

Bug Fix: Fixed regression that broke type inference for packages with no "py.typed" file and no stubs when "useLibraryCodeForTypes" was enabled.

pyright - Published 1.1.100

Published by erictraut almost 4 years ago

Bug Fix: Fixed bug that caused "Type" with no type argument not to be flagged as an error.

Enhancement: Changed pythonPlatform to accept a value of "All" in which case no particular platform will be used over the others.

Bug Fix: Fixed bug that caused improper error when using "self" in a "raise ... from self" statement.

Bug Fix: Fixed bug that caused false negative when using a generic type alias with no type arguments.

Bug Fix: Added cache for logic that determines whether a context manager swallows exceptions (and hence acts like a try/except statement). This cache not only improves performance of code flow walks but also prevents infinite recursion in rare cases.

Behavior Change: Improved handling of unannotated decorator functions. If the decorator returns a function that accepts only *args and **kwargs (which is common), the type checker now assumes that the decorated function or method's signature is unmodified by the decorator. This preserves the original signature and docstring.

Bug Fix: Fixed bug that caused types within a "finally" clause to be evaluated incorrectly in situations where the "try" and all "except" and "else" clauses returned, raised, or broke.

Enhancement: Changed error messages that refer to "named" parameters and arguments to "keyword", which is more standard for Python.

Bug Fix: Fixed bug in declaration provider where the declaration of a member wasn't properly resolved when the LHS of the member access was a call to a function that returns a Type[X].

Bug Fix: Fixed bug that manifest as a problem with enums but was actually a problem in handling the circular dependency between "type" and "object" classes (since "type" is an object and "object" is a type).

Bug Fix: Fixed bug that caused incorrect type evaluation when a class was assigned to a generic protocol that was satisfied by the class's metaclass if the class also derived from a base class that also satisfied the same protocol.

Enhancement: Added code to test for missing annotation in Annotated.

Bug Fix: Fixed false negative where a union type was assigned to a constrained type variable. An error should be generated in this situation.

Enhancement: Added additional validation for TypeVar scoping. If an outer class defines the scope for a type var, functions and variables within an inner class cannot use a TypeVar of the same name.

Bug Fix: Improved handling of "py.typed" for namespace packages and packages with submodules.

Enhancement: Added support for __index__ magic method when used with __getitem__ or __setitem__ magic methods.

Enhancement: Added support for matching modules against protocols as specified by PEP 544.

Bug Fix: Fix for missing docs in completion list due to only checking the setter for docs because its definition comes after the getter.