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

Published by erictraut about 4 years ago

Enhancement: Rework signature help to use new VS Code / LSP APIs. Function overrides and active parameters are handled much, much better.

Enhancement: Added strict-mode check for declared return types in type stubs, which don't allow for return type inference.

Bug Fix: Fixed bug in type checker that resulted in a crash when a function declaration referred to itself within its return type annotation.

Bug Fix: Fixed bug that caused duplicate diagnostics to be reported for quoted type annotations in some cases.

Bug Fix: Fixed bug that caused "find all references" and "replace symbol" to sometimes miss references to a symbol if they were within quoted type annotations or type comments.

Bug Fix: Fixed bugs in a few of the "find all references" tests, which were not properly quoting a forward-declared symbol.

Bug Fix: Fixed a bug that caused infinite recursion and a crash when printing the type of a function that refers to itself within its own return type annotation.

Bug Fix: Fixed bug where an f-string expression generated an error if it ended in an equal sign followed by whitespace. The Python 3.8 spec doesn't indicate whether whitespace is allowed here, but clearly the interpreter accepts it.

Bug Fix: Fixed bug in logic that handles chained comparisons (e.g. "a < b < c"). The code was not properly handling the case where the left expression was parenthesized (e.g. "(a < b) < c").

Enhancement: Improved bidirectional type inference in the case where the type and the expected type are generic but the expected type is a base class that has been specialized. For example, if the expected type is Mapping[str, int] and the type is a dict.

pyright - Publish 1.1.57

Published by erictraut about 4 years ago

Bug Fix: Fixed bug that caused partial type stub creation (for subpackages of a top-level package) to be generated in the wrong directory.

Change in Behavior: Changed logic within type evaluator to track differences between None and NoneType. Previously, they were treated interchangeably. This worked in most cases, but there are some edge cases where the difference is important.

Change in Behavior: Changed logic that converts a type to text so it properly distinguishes between "None" and "NoneType". It previously always output "None".

Enhancement: Added support for "NoneType" matching a type expression "Type[T]" during TypeVar matching.

Bug Fix: Fixed the handling of class or instance variable declarations that redefine a same-named symbol in an outer scope but do not use a variable declaration statement within the class.

Bug Fix: Updated type checker's logic for dealing with symbols that are declared in an inner scope and an outer scope but used within the inner scope prior to being redefined.

Bug Fix: Fixed bug a homogeneous tuple of indeterminate length was indexed with a constant expression.

Enhancement: Made the reportIncompatibleMethodOverride rule smarter. It now properly handles position-only parameters and allows a subclass to extend the signature of a method it is overriding as long as the parameters are *varg, **kwarg, or have default values.

Enhancement: Augmented the reportIncompatibleMethodOverride diagnostic rule to check for cases where a non-function symbol within a subclass redefines a function symbol in a base class.

New Feature: Added new diagnostic rule "reportIncompatibleVariableOverride" which is similar to "reportIncompatibleMethodOverride" except that it reports incompatible overrides of variables (non-methods).

pyright - Published 1.1.56

Published by erictraut about 4 years ago

Bug Fix: Fixed bug that caused the default python platform not to be specified if there was no config file and no python interpreter selected.

Bug Fix: Fixed crash in type checker that occurs when removing NoReturn from a union and having no remaining types.

Bug Fix: Fixed bug that caused __name__ not to be flagged as an invalid attribute on a class instance.

Bug Fix: Fixed bug that caused quoted type annotation (i.e. a forward reference) that contains type arguments to report an "unbound symbol".

Enhancement: Improved CompletionItemKind for intrinsic class symbols like __name__, etc.

Bug Fix: Fixed bug in parsing of unicode named character encodings within string literals when the encoding included capital letters.

Bug Fix: Fixed bug whereby a non-function definition (such as an instance variable) within a subclass was not considered as having overridden an abstract method or property within a base class.

Change in Behavior: Changed Never internal type to be assignable to any type. Previously, it was assignable to no type.

Bug Fix: Fixed bug that caused a spurious error during TypeVar matching when the TypeVar is constrained and is initially matched against an Any or Unknown type but is later matched against a known type.

Bug Fix: Fixed bug in dataclass logic that reported spurious error when initializing attribute with field(init=False).

Change in Behavior: Renamed ParameterSpecification to ParamSpec to reflect latest PEP 612 changes.

Enhancement: Updated typeshed fallback stubs to latest version.

Change in Behavior: Updated PEP 612 and 614 features to be dependent on 3.10 rather than 3.9.

Bug Fix: Fixed bug that caused diagnostics to persist in files that are not part of the workspace even after they are closed.

Bug Fix: Fixed bug that generated incorrect type checking error when type alias used a Type[x] type annotation.

pyright - Published 1.1.55

Published by erictraut about 4 years ago

Bug Fix: Changed logic for reportMissingModuleSource diagnostic rule so it isn't reported for stub files.

Enhancement: Added support for typing.OrderedDict, which is a generic alias for collections.OrderedDict.

Enhancement: Added support for new Python extension callback so Pyright extension is notified when pythonPath is modified.

Bug Fix: Fixed bug in docstring trimming code that resulted in some docstrings (those consisting of two lines where the second line was empty) not appearing when hovering over functions.

Bug Fix: Fixed bug in type checker that resulted in incorrect error when creating a generic type alias with a compatible TypeVar as one of the type arguments.

Bug Fix: Fixed bug that caused value expressions for default parameter values in lambdas to be evaluated within the wrong scope resulting in errors if the lambda scope had a same-named symbol.

Bug Fix: Fixed bugs in handling of wildcard imports. First, it was not properly handling the implicit introduction of symbol A in the statement "from .A import *". Second, it was implicitly including submodules as part of the wildcard, and it shouldn't.

Bug Fix: Fixed bug that resulted in incorrect error when using an unpack operator in an argument expression that corresponds to a *varg parameter in the callee.

Bug Fix: Fixed recent regression that caused 'isinstance' check to emit a bad error when 'self.class' was passed as a second argument.

pyright - Published 1.1.54

Published by erictraut over 4 years ago

Enhancement: Added json schema for mspythonconfig.json (in addition to pyrightconfig.json).

Enhancement: Updated config file watcher logic so it can detect when a new config file is added to a workspace.

Bug Fix: "Find all references" should not return references to a symbol within library code unless that library source file is currently open in the editor.

Bug Fix: Fixed bug in type checker that caused a crash when analyzing an abstract class with a constructor that contained two or more parameters, all of which are unannotated.

Bug Fix: Fixed pyrightconfig.json JSON schema to accept "information" as a valid diagnostic severity setting.

Enhancement: Updated log levels for messages logged by the Pyright service. Some log levels were "info" but should have been "warning" or "error".

Bug Fix: Fixed bug that caused incorrect type evaluation for *args or **kwargs parameters if no type annotation was present. This bug also affected completion suggestions for these parameters.

Bug Fix: Fixed a bug that resulted in Pyright attempting to parse and analyze binaries (native libraries) like ".pyd" and ".so" files.

Bug Fix: Fixed bug in argument/parameter matching when an unpack operator is used in the argument and the parameter is a *varg type.

Enhancement: Renamed setting "pyright.useLibraryCodeForTypes" to "python.analysis.useLibraryCodeForTypes" for compatibility with Pylance. The older setting name is still supported but will be removed in the future.

Enhancement: Added code to handle the case where a class is assigned to a type described by a callable protocol object. In this case, the class constructor's signature should be compared against the __call__ signature defined in the protocol.

Bug Fix: Fixed bug in import resolver that caused imports that referred to local namespace packages not to resolve.

Bug Fix: Fixed bug that caused enum names that were not uppercase to be handled incorrectly.

Bug Fix: Fixed bug that caused incorrect type analysis when a package __init__.py imported and re-exported a symbol that matched the submodule it was being imported from, e.g. from .foo import foo.

Bug Fix: Fixed bug in type analyzer where default value expressions for lambda parameters were not being evaluated. This meant that errors related to these expressions were not reported, and symbols referenced within them were marked as unreferenced.

pyright - Published 1.1.53

Published by erictraut over 4 years ago

Bug Fix: Fixed bug in parser where it was emitting a spurious error about function return type annotations being a tuple when it was simply enclosed in parentheses.

Bug Fix: Fixed a bug that caused completion suggestions not to work for the LHS of a member access expression (e.g. the "a" in "a.b").

Bug Fix: Fixed diagnostic message for "partially unknown" types (used in strict mode). It was incorrectly using the "unknown" message rather than "partially unknown", which could lead to confusion.

Enhancement: Changed type printing logic to emit "Unknown" annotations when in strict mode to make it clearer to the user which part of the type is unknown.

Bug Fix: Fixed bug that caused extension to report empty diagnostics for all tracked files when unnecessary (in particular, when the diagnostic mode is set to openFilesOnly and the file is not open).

Enhancement: Added partial support for mypy-supported variant of "# type: ignore" comment where specific error codes in square brackets after the "ignore". Pyright doesn't honor the specific error codes but now treats it as a normal # type: ignore" comment.

Bug Fix: Fixed bug that caused the arguments of a call to remain unanalyzed if the LHS of the call was not callable. This resulted in omitted errors and spurious unreferenced symbols.

Bug Fix: Changed diagnostic for second argument to "Enum" call to be dependent on the reportGenalTypeIssues diagnostic rule rather than unconditional.

Bug Fix: Fixed recent regression relating to "isinstance" type narrowing when the type of the target is a constrained TypeVar.

Bug Fix: Fixed bug in the handling of the NewType function introduced in PEP 484. The previous code was not synthesizing a constructor (__init__ method) as specified in the PEP.

Enhancement: Changed fallback mechanism for detecting the configured python interpreter to use the shell command "python3" first and then "python" if that fails. This is preferable on Linux and MacOS because "python" typically points to a Python 2.7 interpreter.

Enhancement: Added parser error for relative imports of the form "import .abc". This is treated as a syntax error by the Python interpreter and should be flagged as such.

Bug Fix: Fixed bug with "from . import a" form of import. Diagnostic was not logged when "a" could not be resolved.

pyright - Published 1.1.52

Published by erictraut over 4 years ago

Bug Fix: Fixed escaping of literal strings when printing Literal string types.

Enhancement: Improved completion suggestions related to member access expressions (e.g. obj.method) by binding the method to the object when appropriate.

Enhancement: When hovering over class name that is used in a constructor call, display the __init__ method signature rather than the class.

Bug Fix: Fixed recent regression in unreachable code reporting at the module level.

Bug Fix: Removed error message for unexpected dynamic argument types to type initializer.

Bug Fix: Fixed a bug in the code that validates an exception type in an "except" clause. It was not properly handling the case where the type of the exception was specified as a Type[X] object.

Bug Fix: Reverted part of a previous change where constrained type vars were specialized as a union of the constrained types. Changed logic to use first constrained type only.

Bug Fix: Fixed bug in logic that detects assignment compatibility for function types. It wasn't properly handling generic parameters, including synthesized TypeVar types used for "self" parameters.

Bug Fix: Added diagnostic for TypeVar or generic class with type args being used as a second argument for isinstance or issubclass. These will raise a TypeError exception at runtime.

Enhancement: Changed Pyright import resolution order to match that described in PEP 561. In particular, stubs in stubPath are now searched prior to user code, and third-party typeshed stubs are searched only after installed packages are searched for stub packages and inline stubs. There is one place where Pyright's import resolution still differs from a strict interpretation of PEP 561: it searches stdlib typeshed stubs first (unless typeshedPath is defined, in which case it searches there). This is more consistent with the way the Python interpreter resolves stdlib types.

Bug Fix: Fixed bug in handling of constructor that uses a specialized class (e.g. MyClass[int]()). The previous code was inappropriate overriding the provided type arguments as part of bidirectional inference logic.

Bug Fix: Fixed bug that caused spurious errors when assigning a specialized object/class to a variable whose type is a specialized base class of the specialized object/class.

pyright - Published 1.1.51

Published by erictraut over 4 years ago

New Feature: Added document highlight provider. When you click on a symbol in the editor, all other symbols within the same file that have the same name and have the same semantic meaning are also highlighted.

Enhancement: If reportGeneralTypeIssues rule is disabled, don't replace assigned type with declared type because it will lead to additional errors that will confuse users.

Enhancement: Added type narrowing support for "in" operator when RHS is a specialized list, set, frozenset, or deque.

Enhancement: Added logic to validate that RHS operand used with "in" and "not in" operators support the __contains__ magic method.

Bug Fix: Fixed bug where "field" initialization of dataclass member didn't take into account "default" or "default_factory" parameters when determining whether the field had a default value.

Bug Fix: Added code to deal with the special case where a method declared with a "def" statement is later overwritten with a callable instance variable.

Bug Fix: Fixed bug whereby a TypeVar type was not treated the same when it was alone versus within a union leading to some subtle differences in error reporting. Also changed specialization of constrained TypeVars to be a union of constrained types rather than Unknown if the TypeVar is not used as a type argument.

Bug Fix: Fixed bug in diagnostic message for constrained TypeVar type mismatch. The wrong type was being printed leading to confusing errors.

Bug Fix: Fixed a bug that caused incorrect linearization of classes during MRO calculation.

Bug Fix: Fixed bug in synthesized version of get method for TypedDict class. It should provide an overload that allows for any str key and return an "Unknown" type.

pyright - Published 1.1.50

Published by erictraut over 4 years ago

Bug Fix: Fixed regression in completion provider when retrieving suggestions for "self.". Added test to cover this case.

Enhancement: Changed "x is not iterable" diagnostic to be part of the "reportGeneralTypeIssues" rule so it doesn't get reported if typeCheckingMode is "off".

Bug Fix: Fixed bug that caused incorrect behavior when a symbol was imported multiple times in the same file.

Bug Fix: Fixed bug that caused Callable instance variables to be treated as though they needed to be "bound" to the object at the time they were accessed. This resulted in spurious errors about parameter count because an implicit "self" parameter was assumed.

Enhancement: Improved type analysis performance by 5-10% on typical code and by significantly more on certain code sequences that involve many if statements within a loop. This optimization uses code flow caching to determine when incomplete types (those that haven't been fully resolved) are potentially stale.

Bug Fix: Fixed recent regression related to imports of the form "from .x import y" within an __init__.py(i) file.

Enhancement: Changed type analyzer to use module-level __getattr__ for types only if the file is a stub.

Enhancement: Added code to prevent "variable possibly unbound" error from propagating to other variables. It should be reported only once.

Enhancement: Switched "pyright.typeCheckingMode" to "python.analysis.typeCheckingMode" for compatibility with Pylance.

Enhancement: Moved a few parameter-related diagnostics to the "reportGeneralTypeIssues" diagnostic rule rather than being unconditional errors.

Bug Fix: Fixed bug that resulted in incorrect type inference for a member variable that is not assigned within a class but is assigned within an ancestor class.

Enhancement: Added type narrowing support for "is" and "is not" operator where RHS is an enum literal value.

pyright - Published 1.1.49

Published by erictraut over 4 years ago

Bug Fix: Fixed bug that caused incorrect type to be determined for *args and **kwargs parameters in some contexts.

Enhancement: Updated typeshed stubs to the latest versions from the typeshed repo.

Bug Fix: Fixed bug in tokenizer where it was generating an error if escaped unicode characters (using the \N{name} escape) contained a space in the name.

Enhancement: Improved parse recovery for statements that are supposed to end in a colon followed by a suite of other indented statements. Previously, a missing colon or expression error resulted in a cascade of additional errors.

Enhancement: Improved error message for overloaded calls where no overload matches the provided arguments.

Bug Fix: Fixed bug in unreachable code detection and reporting. The logic was previously split between the binder (which used proper code flow analysis) and the checker (which didn't use code flow analysis but had access to NoReturn call information). The new code combines everything into the checker and uses both code flow analysis and NoReturn call info.

Bug Fix: Added code to include a symbol in a module if the source file is an "init.py(i)" and a relative import of the form "from .x.y.z import X" is used. In this case, the symbol "x" should appear within the module's namespace.

Bug Fix: Fixed bug in pyrightconfig schema. The defaults for several settings were using strings "true" and "false" rather than booleans true and false.

Bug Fix: Fixed bug in parser that generated a spurious error when an unparenthesized assignment expression (walrus operator) was used as an argument. PEP 572 indicates that this should be allowed in cases where the argument is not named.

Enhancement: Changed constructor type analysis logic to always specialize the instantiated instance.

Bug Fix: Fixed bug in reportAssertAlwaysTrue diagnostic. It wasn't properly handling tuples of indeterminate length.

Bug Fix: Fixed bug in import resolution that resulted in an unresolved import when a local folder was present with the same name as the imported third-party library.

Bug Fix: Fixed bug that caused diagnostics for unopened files to remain in "problems" panel after switching diagnostic mode from "workspace" to "open files only".

Bug Fix: Fixed bug in parsing of f-string expressions that contain nested braces.

Bug Fix: Fixed bug in import resolver where it was not preferring regular package imports over namespace packages.

pyright - Published 1.1.48

Published by erictraut over 4 years ago

Enhancement: Added support for accessing metaclass members from class. This allows, for example, access to the __members__ attribute of an Enum class.

Enhancement: Added type completion support for class attributes provided by a metaclass.

Bug Fix: Fixed bug that caused unbound variables to go unreported if they had type annotations.

Bug Fix: Fixed bug in type narrowing logic for isinstance call. It wasn't properly handling bound TypeVar types. This includes synthesized bound TypeVars like those used for unannotated "self" and "cls" parameters.

Bug Fix: Fixed bug that caused stand-alone expression statements (those that are not included in other statements) to go unchecked, resulting in symbols potentially unreferenced and type errors unreported.

Bug Fix: Fixed bug where the use of unpack operator within a tuple not surrounded by parens within a return/yield statement incorrectly reported an error when used with Python <3.8.

Bug Fix: Changed signature help provider to use the __init__ method signature (if available) for class construction expressions. It previously used the __new__ method signature by default.

Enhancement: Unaccessed function parameters are now displayed as "grayed out" in VS Code. There was previously code in place to do this, but it contained a bug that went unnoticed.

pyright - Published 1.1.47

Published by erictraut over 4 years ago

Enhancement: Improved support for type aliases, especially those with generic parameters. Type alias names are now tracked and used within printed type names.

Bug Fix: Fixed recent regression in CLI that resulted in unintended verbose logging output.

Bug Fix: Added minimum node version to package.json to prevent installation of pyright CLI on incompatible versions of node.

Enhancement: Added code to better handle the obsolete "<>" operator from Python 2 - including a better error message and better parse recovery.

Enhancement: Added special-case handling of 'NoReturn' type to allow Never type to be assigned to it. This can be used to verify exhaustive type narrowing.

Bug Fix: Added code to differentiate between Protocol symbol in typing.pyi versus typing_extensions.pyi. The latter can be used on older versions of Python.

Enhancement: Changed activation events to remove glob path for pyrightconfig.json, which speeds up extension activation on large projects. Added support for mspythonconfig.json

pyright - Published 1.1.46

Published by erictraut over 4 years ago

Enhancement: Added checks to ensure that type annotations contain only class types, not instantiated objects.

Enhancement: Added code to filter out duplicate "pseudo-generic" types in unions when printing them. We omit the type arguments when printing pseudo-generic types, so without this filtering, we were seeing seemingly-duplicated types.

Enhancement: Added support for literal type aliases used within Literal type arguments.

Bug Fix: Fixed bug in handling of unpack operator when used as an assignment target. It should be typed as List, not as Iterable.

Bug Fix: Fixed recent regression that affected the logic that combines Literal[True] and Literal[False] into bool.

Enhancement: Added support for several "type" metadata fields that are accessible on classes that derive from type. This includes __subclasses__, __module__, etc.

Enhancement: Added more trace logging to output pane.

Bug Fix: Fixed bug in hover text. Sometimes hovering over a module import target didn't display the module-level doc string.

Enhancement: Added severity level enum to package.json so it is editable within the VS Code settings UI.

pyright - Published 1.1.45

Published by erictraut over 4 years ago

Bug Fix: Fixed bug in call hierarchy provider that caused aliased symbols to be reported incorrectly.

Enhancement: Added support in call hierarchy provider for properties.

Bug Fix: Improved handling of dataclass entries that use "field(init=False)" to specify that the field should not be included in the synthesized __init__ method's parameter list.

Enhancement: Added support for the new Python extension setting for pythonPath. This mechanism replaces the soon-to-be-deprecated "python.pythonPath" setting.

Bug Fix: Nested lists were not properly passing through the expected subtype if it included a union.

Bug Fix: Fixed bug that caused a use of Final within a dataclass to be flagged as an error.

Bug Fix: If left unspecified Pyright is meant to assume the Python version and platform from the currently-selected interpreter. This wasn't correctly set if there was no pyrightconfig.json config file.

pyright - Published 1.1.44

Published by erictraut over 4 years ago

New Feature: Added call hierarchy provider, which allows the client to display all callers of a function or all calls made by a function.

Bug Fix: Fixed bug in code that scans for source files within the project that caused an infinite loop if it encountered a symbolic link that created a cycle.

Bug Fix: Changed logic that computes union types to strip out NoReturn types if they are combined with other types. A "NoReturn" should always appear by itself, never in a union.

Enhancement: Improved error messages for argument type mismatches.

Bug Fix: Fixed bug that caused code to be marked as "unreachable" if a lambda declaration involves a call to a NoReturn function.

Bug Fix: Added missing support for __rmatmul__ (reverse matrix multiply) operator overload method.

Bug Fix: Fixed bug in the handling of code actions that appear in the first line.

Enhancement: Make logging level to Output configurable.

Enhancement: Improved auto-import feature so it now handles auto-imports of all installed packages instead of only those that have been referenced previously within the project.

Bug Fix: Fixed docstring fetching in relative import cases, -stub packages.

Bug Fix: Fixed bug that caused an internal error when typing certain decorators at the module scope.

Enhancement: Added support for unpacking of tuples with specified element types within argument lists. The type checker now properly expands these tuples and matches individual element types against corresponding parameters in the callee.

Enhancement: Improved error messages for TypeVar mismatches (e.g. invariance).

Enhancement: Extended bidirectional type inference to function call expressions where the callee has a declared return type that is generic.

pyright - Published 1.1.43

Published by erictraut over 4 years ago

Bug Fix: Fixed bug in type inference for list comprehensions. It should inter the type AsyncGenerator rather than Generator if the comprehension uses the "async" keyword.

Bug Fix: Fixed bug that caused overloaded function and class decorators to generate errors inappropriately.

Bug Fix: If a module cannot be resolved during type analysis, treat the symbol as "unknown" rather than "unbound" so usage of that symbol doesn't result in further errors.

Bug Fix: Fixed bug that generated incorrect error when a function declaration used a parameter with no default arg value after a parameter with a default arg value after a var-arg parameter.

Bug Fix: Fixed bug in handling of negative integers when used as Literal type arguments.

Enhancement: Updated typeshed stub files to the latest.

Enhancement: Added support for alternate syntax for TypedDict that uses named arguments rather than a single dictionary argument.

Bug Fix: Fixed bug where hover type of annotated variable was disclosed as "Unknown" if there was no assignment to that variable. It should display the annotated type.

Bug Fix: Fixed bug that caused the hover text for named arguments used to initialize a dataclass to indicate that the type was "Any" rather than the correct type.

Enhancement: Improved error messages for dictionary statements that are assigned to TypedDict variables or function arguments.

Bug Fix: Fixed a bug in code flow analysis logic that caused type to be evaluated as Never.

pyright - Published 1.1.42

Published by erictraut over 4 years ago

Enhancement: Added diagnostic for objects that are called but do not have a call method.

Bug Fix: Fixed bug that caused call arguments to not be evaluated (and therefore not type checked or marked accessed) if certain errors were detected while evaluating types for a call expression.

Enhancement: Added logic to avoid doing a complete reanalysis when a temporary file is momentarily created by an auto-formatter like Black.

Bug Fix: Fixed bug that caused some illegal uses of "Final" (as defined in PEP 591) to not be reported.

Bug Fix: Avoid duplicate imports in completion results.

Bug Fix: Fixed bug in dataclass logic so it properly excludes ClassVar entries as per PEP 557.

Bug Fix: Fixed bug in code flow logic for handling certain assignments within loops where the same symbol is on the left and right side of the assignment.

pyright - Published 1.1.41

Published by erictraut over 4 years ago

Enhancement: Added type guard support for conditional expressions of the form (x := expr) is None and (x := expr) is not None.

Enhancement: Added logic to "gray out" code after a call to a "NoReturn" function to indicate that the code is unreachable.

Bug Fix: Fixed bug that resulted in a crash if a type annotation on an instance variable referred back to the variable itself.

Bug Fix: Fixed bugs in a couple of localized strings.

Bug Fix: Fixed bug that caused private variables to be reported as unaccessed in cases where they were.

Bug Fix: Fixed hole in exception handling within type evaluator that could leave the control flow graph in an inconsistent state if a cancellation exception occurred at the wrong time.

Bug Fix: When typeCheckMode is set to "off", avoid displaying "Any" twice within a Union (due to "Unkown" being reported as "Any").

Enhancement: Improved support for nested finally clauses.

Enhancement: Hover results for named parameter at call site now displays the expected parameter type rather than the provided argument type.

Bug Fix: Fixed compliance with PEP 557 which says that fields without type annotations shouldn't be considered as data fields within a data class.

Bug Fix: Fixed bug in chained comparison expression handling (e.g. a < b < c) that caused the left half of the expression not to be type checked.

pyright - Published 1.1.40

Published by erictraut over 4 years ago

Enhancement: Completion provider now supports auto-import for modules rather than just symbols within modules (i.e. "import X" form in addition to "from X import Y").

Bug Fix: Fixed bug that caused type guards not to work properly in some cases where an assignment expression (walrus operator) was used within the conditional statement and the value assigned to the target symbol involved a function call.

Bug Fix: Fixed bug that caused "|" operator used with variables of type "Any" to be incorrectly interpreted as union syntax.

Enhancement: If the pythonPlatform or pythonVersion are not specified, they are now initialized based on the current platform and configured python interpreter.

Bug Fix: Fixed bug that incorrectly flagged as an error some usage of a named exception symbol within an except clause.

Bug Fix: Changed logic for tracking incomplete types within the code flow engine. This fixes a bug in code flow analyzer that caused false positive errors to be reported in some cases involving loops.

Enhancement: Added localization mechanism for strings used in diagnostic messages and code actions. Strings are not yet localized, but this sets the stage for future improvements.

Bug Fix: Fixed bug that caused incorrect translation of a file offset to a line/col if the position was after the last character in the file. If a diagnostic range covered this final character, it was shortened by one character.

Enhancement: Diagnostics for reportUnknownParameterType rule are now suppressed if the parameter is named "_".

Bug Fix: Fixed bug in reportUnnecessaryIsInstance rule that triggered an inappropriate error when the target class was derived from a base class that was unknown (e.g. due to an import resolution failure).

pyright - Published 1.1.39

Published by erictraut over 4 years ago

New Feature: Added support for Python 3.9 "Annotated" feature described in PEP 593.

Enhancement: Expanded special-case code in parser to handle t.Literal (as well as typing.Literal) as a way of identifying use of the built-in "Literal" symbol.

Bug Fix: Fixed bug in binder that caused targets of assignment expressions (walrus operator) to appear as "Unknown" type in some cases.

Enhancement: Added support for module-level getattr method, used in type stubs to indicate incomplete definitions.

Behavior Change: Removed reportTypeshedErrors diagnostic rule. It no longer makes sense given how errors are being reported.

Bug Fix: Fixed regression introduced in 1.1.38 that caused type analysis errors to be reported for source files that "shadow" type stub files for the purpose of displaying doc strings. These errors were not only displayed but were persistent even after the file was closed in the editor.

Enhancement: Changed the type of "self" and "cls" parameters to use synthesized type variables that are bound to the type of the enclosing class. This allows subclasses to call these methods and replace self and cls with their own subclass type.

New Feature: Implemented support for Python 3.9 TypeAlias feature as described in PEP 613.

Bug Fix: Added logic to avoid using unreachable assignments when inferring the effective type of a variable. This avoids creating false cycles when resolving types for symbols that depend on each other.