Commit Graph

5924 Commits

Author SHA1 Message Date
Dmitry Volodin
14b0831697
Fix Markdown links (#4849)
* Fixed Markdown links

* Gave main doc page prettier name
2023-03-27 19:48:11 -06:00
Eric Traut
7e818af9be Fixed bug that resulted in a false positive error when doing protocol matching where the object type (i.e. the self value) is a literal value. This addresses https://github.com/microsoft/pyright/issues/4844. 2023-03-26 21:25:38 -06:00
Eric Traut
5cf4aedbbf Did a pass over pyright source code to improve consistency of file header comments. No functional change. 2023-03-26 14:05:02 -06:00
Eric Traut
47efdfcf2c Fixed a bug that resulted in a false negative when using a type variable with an incompatible variance to specialize a generic class that uses a TypeVarTuple. This addresses https://github.com/microsoft/pyright/discussions/4841. 2023-03-25 08:33:24 -06:00
Eric Traut
95d4809d4c Fixed bug that resulted in an false positive error when using a class (and by implication, its constructor) as an input to a generic function (e.g. a decorator) that is parameterized with a ParamSpec. This addresses https://github.com/microsoft/pyright/issues/4813. 2023-03-25 06:16:45 -06:00
Eric Traut
14f458717d Added support for synthesized __slots__ symbol in dataclasses that are constructed using the slots=True argument. This addresses https://github.com/microsoft/pylance-release/issues/4147. 2023-03-24 18:09:21 -06:00
Eric Traut
8a93373e6b Added support for "naked" ClassVar used to annotate a class variable that is assigned a descriptor object but is later set through an object member access. This previously resulted in a false positive error. This addresses https://github.com/microsoft/pyright/issues/4838. 2023-03-24 11:10:59 -06:00
Eric Traut
f63069227c Fixed a bug that led to the incorrect evaluation of a symbol imported through a from a.b import c statement if a.b is a non-py.typed library, useLibraryCodeForTypes is false and c was also the name of a submodule of a.b. In this case, the evaluated type of c should be Unknown, but it was incorrectly evaluated as a module type. This addresses https://github.com/microsoft/pyright/issues/4827. 2023-03-24 07:06:08 -06:00
Eric Traut
e7668aef88 Added support for a TypeGuard function where the first argument is a TypeVar. In this case, the resulting (narrowed) type should be a conditional type that references the TypeVar. 2023-03-23 01:16:12 -06:00
Eric Traut
98e2134ea7 Reduced verbosity of CLI output for non-error conditions. 2023-03-22 18:21:31 -06:00
Eric Traut
968ffc90fa Revert "Fixed a bug that led to the incorrect evaluation of a symbol imported through a from a.b import c statement if a.b is a non-py.typed library, useLibraryCodeForTypes is false and c was also the name of a submodule of a.b. In this case, the evaluated type of c should be Unknown, but it was incorrectly evaluated as a module type. This addresses https://github.com/microsoft/pyright/issues/4827."
This reverts commit cca8ce8a41.
2023-03-22 16:30:36 -06:00
Eric Traut
cca8ce8a41 Fixed a bug that led to the incorrect evaluation of a symbol imported through a from a.b import c statement if a.b is a non-py.typed library, useLibraryCodeForTypes is false and c was also the name of a submodule of a.b. In this case, the evaluated type of c should be Unknown, but it was incorrectly evaluated as a module type. This addresses https://github.com/microsoft/pyright/issues/4827. 2023-03-22 16:03:44 -06:00
Eric Traut
903fd3cee3 Added support for argument dictionary unpacking when the type of the unpacked object supports the SupportsKeysAndGetItem protocol. Previously, the object needed to be an explicit subclass of Mapping. This addresses https://github.com/microsoft/pyright/issues/4826. 2023-03-22 14:50:17 -06:00
Eric Traut
02e3e96522 Fixed bug that resulted in false positive "incompatible variance" error when covariant and contravariant type variables were used in certain combinations when defining a generic class. This addresses https://github.com/microsoft/pyright/issues/4818. 2023-03-22 14:00:58 -06:00
Eric Traut
8d9ad7958d Fixed recent regression that caused a crash in the signature help provider. 2023-03-22 12:56:11 -06:00
Eric Traut
56c6eddc47 Fixed bug that caused diagnostic for implicit override to be reported as part of reportGeneralTypeIssue rather than `reportImplicitOverride. This addresses https://github.com/microsoft/pyright/issues/4824. 2023-03-22 12:31:26 -06:00
PylanceBot
0447197153
pull-pylance-with-pyright-1.1.300 (#4816)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Rich Chiodo <rchiodo@microsoft.com>
2023-03-22 10:23:18 -07:00
Eric Traut
f9a7382989 Published 1.1.300 2023-03-21 22:46:14 -06:00
Eric Traut
3ae66f24b0 Fixed a recent regression that resulted in a false positive error when a multi-part import statement was used and useLibraryCodeForTypes was disabled. This addresses https://github.com/microsoft/pyright/issues/4810. 2023-03-21 00:30:37 -06:00
Eric Traut
ae873e49dd Fixed regression that resulted in internal corrupt state and odd behaviors like builtin symbols being marked as "not found" in some circumstances. 2023-03-20 23:07:27 -06:00
Eric Traut
23cac90295 Added small simplification and performance improvement in code path that adds a new tracked file. No functional change. 2023-03-20 22:58:51 -06:00
Eric Traut
bc15a7b742 Fixed a couple of misspellings in comments. No functional change. 2023-03-20 20:16:50 -06:00
Eric Traut
d860256d58 Extended support for reportUnnecessaryComparison check to handle dataclass types that use a synthesized __eq__ method. This addresses https://github.com/microsoft/pyright/issues/3034. 2023-03-20 12:41:02 -06:00
Eric Traut
54dbe9a8bd Fixed a bug that led to the incorrect type resolution for unsupported function Enum class construction. The resulting type should be Unknown, but it was evaluated as Never. This addresses https://github.com/microsoft/pyright/issues/4808. 2023-03-20 12:22:09 -06:00
Eric Traut
252673152d Updated typeshed stubs to the latest version. 2023-03-19 11:08:17 -06:00
Eric Traut
b9e72bf147 Improved consistency of type narrowing on assignment when the target is a variable with a declared type and the assigned value is an unknown or partially-unknown type. Previously, if the assigned value was Unknown, the declared type was assumed, but if the assigned value was a union that included Unknown, the narrowed type (including the Unknown) was assumed. We now always include an Unknown in the assigned type so the reportUnknownVariableType diagnostic is reported. 2023-03-19 08:11:55 -06:00
Eric Traut
d36c524916 Fixed a couple of bugs in the type narrowing logic for class pattern matching. In particular, added better support for NoneType() patterns and cases where the subject type is a union that includes subtypes of the class pattern. This addresses https://github.com/microsoft/pyright/issues/4800. 2023-03-19 00:58:54 -06:00
Eric Traut
7ad4a8ead5 Added support for @deprecated in an __init__ method when constructing a class. This addresses https://github.com/microsoft/pyright/issues/4456. 2023-03-18 18:30:41 -06:00
Eric Traut
575adcb29a Fixed a bug that can result in infinite recursion (and a subsequent crash) when a class instance is called and the class defines a __getattr__ method. This addresses https://github.com/microsoft/pyright/issues/4798. 2023-03-17 16:00:59 -06:00
Bill Schnurr
1af9bf8715
fixed missing imports inside try/catch blocks when createTypeStub comm… (#4796) 2023-03-17 12:03:58 -07:00
PylanceBot
68a8e98ab8
pull-pylance-with-pyright-1.1.299 (#4797)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Rich Chiodo <rchiodo@microsoft.com>
2023-03-17 11:45:22 -07:00
Eric Traut
cb9952a00b Improved hover text for methods that are synthesized (e.g. the get method for TypedDict). This partly addresses https://github.com/microsoft/pylance-release/issues/4098. 2023-03-17 10:36:13 -06:00
Eric Traut
34e12fc15a Added support for clear and popitem methods on TypedDict instance that is marked @final and has no required entries. This addresses https://github.com/microsoft/pyright/issues/4794. 2023-03-17 08:46:43 -06:00
Eric Traut
9af43f28fe Fixed bug that resulted in a crash when user types import without a follow-on module name. This can happen in due corse of typing an import statement. This addresses https://github.com/microsoft/pyright/issues/4778. 2023-03-17 08:18:27 -06:00
Eric Traut
c7c70357dc Changed the logic in the code flow engine so it never attempts to infer a NoReturn return type for a function that lacks a return type annotation. This results in a big speed improvement for some (unannotated) code bases, but it also produces somewhat inconsistent type evaluation results because a function whose type is inferred to be NoReturn by the type checker will not be treated as such if it is called elsewhere in the program. 2023-03-17 08:08:05 -06:00
Eric Traut
0997c33577 Fixed regression that caused a crash in the presence of the illegal statement import .. This addresses https://github.com/microsoft/pyright/issues/4778. 2023-03-16 15:25:41 -06:00
Eric Traut
425908eced Fixed bug that resulted in a false positive error relating to variance incompatibility. This addresses https://github.com/microsoft/pyright/issues/4111. 2023-03-16 14:59:33 -06:00
Eric Traut
e2e3a5c9ff Added new diagnostic check reportImplicitOverride. This addresses https://github.com/microsoft/pyright/issues/4788. 2023-03-16 09:52:25 -06:00
Eric Traut
c7ab8045ba Performance: Further improved perf when determining type compatibility of unions with many subtypes. This further reduces the analysis time of pydantic from 12s to 4s. This addresses https://github.com/microsoft/pyright/issues/4781. 2023-03-16 09:12:51 -06:00
Eric Traut
99c73a0f7d Performance: sped up type analyzer by 5-25% by caching types that have been converted to or from an instance. This drops the analysis time of pydantic from 17s to 12s. 2023-03-16 08:15:56 -06:00
Eric Traut
2ca9a8af4a Fixed regression that resulted in a false positive error when using an index expression form with a class whose metaclass supplies a __getitem__ method when the expression is used as a runtime expression, as opposed to a type expression. This addresses https://github.com/microsoft/pyright/issues/4785. 2023-03-16 07:41:49 -06:00
Erik De Bonte
6de737544c
Push pylance changes to pyright (#4783)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Rich Chiodo <rchiodo@microsoft.com>
2023-03-15 17:27:27 -07:00
dependabot[bot]
cebfc312e5
Bump webpack from 5.75.0 to 5.76.0 in /packages/pyright (#4774)
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-15 07:41:28 -06:00
Eric Traut
ac9b89c255 Published 1.1.299 2023-03-15 00:16:59 -06:00
Eric Traut
c272a608f3 Fixed a bug that led to incorrect "circular reference" error for a type alias declaration in certain circumstances when that type alias was used in a parameter or return type annotation. This addresses https://github.com/microsoft/pyright/issues/4770. 2023-03-14 14:45:25 -06:00
Eric Traut
ce66cc21bb Fixed a bug that led to a false negative when a non-Generic class has a metaclass that defines a __getitem__ method. Such a class should not be indexable within a type annotation, but pyright was not flagging this error. This addresses https://github.com/microsoft/pyright/discussions/4766#discussioncomment-5291138. 2023-03-13 12:24:55 -06:00
Eric Traut
a28fb5d560 Fixed bug that caused incorrect results with --verifytypes when NewType was used to define a type prior to Python 3.9. This addresses https://github.com/microsoft/pyright/issues/4764. 2023-03-12 15:21:54 -06:00
Eric Traut
7c23b1afb8 Updated logic for PEP 696 (TypeVarLike "defaults") to change the syntax for ParamSpec default expressions. The draft PEP is being changed, and list expressions will now be used instead of tuples. 2023-03-11 12:08:37 -07:00
Eric Traut
128e169415 Fixed regression that led to a false positive error in some cases where when a wildcard pattern is used in a case statement within a loop. This addresses https://github.com/microsoft/pylance-release/issues/4058. 2023-03-10 22:44:22 -07:00
Eric Traut
65fc73251b Fixed a recent regression that resulted in multi-part imports being evaluated as unknown if a namespace package was used for an intermediate part of the module path and useLibraryCodeForTypes was set to false. This addresses https://github.com/microsoft/pyright/issues/4759. 2023-03-10 07:48:12 -07:00