Commit Graph

7526 Commits

Author SHA1 Message Date
Eric Traut
114817af10
Updated typeshed stubs to the latest. This version of typeshed replaces the older-style positional-only parameters with PEP 570 syntax. (#7493) 2024-03-15 08:48:52 -06:00
Eric Traut
ca142066b3
Fixed bug that results in false positive when implicitly specializing a class parameterized by a TypeVarTuple when there is no default. This addresses #7489. (#7491) 2024-03-15 01:00:00 -06:00
Eric Traut
c6f8b83c4a Renamed typeUtils function for consistency. 2024-03-14 23:53:21 -06:00
Eric Traut
18243af812
Fixed bug that results in a false negative when a TypeAliasType object is used in a class pattern. This addresses #7485. (#7486) 2024-03-14 13:43:02 -06:00
Eric Traut
d7dc004c78 Fixed a bug that results in incorrect type evaluation if a list expression includes a generator expression. This addresses #7481. 2024-03-14 10:54:44 -06:00
PylanceBot
6c4b329177
pull-pylance-with-pyright-1.1.354 (#7476)
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-13 11:03:37 -07:00
Eric Traut
0a73f4b0f5 Published 1.1.354 2024-03-13 09:22:00 -06:00
Eric Traut
0334a44b83 Fixed a bug that made locale overrides through environment variables no longer work on node 21. This change removes the ability to override the localized language through the use of the global navigator object. This previously applied only to browser, but now node 21 supports this, which means that pyright users had no way to override it. If the pylance team wants localization to work in a browser, they'll need to find a better way to abstract this so it doesn't break pyright. This addresses #7439. 2024-03-12 00:38:05 -06:00
Eric Traut
6a042f7b58
Added new reportUnhashable diagnostic rule. This addresses #7462. (#7464) 2024-03-12 00:34:58 -06:00
Eric Traut
3ccd7b87b5
Fixed a bug that results in a false negative when a class explicitly inherits from a protocol that defines an instance variable but the child re-declares as a ClassVar without an explicit type. This addresses #7455. (#7463) 2024-03-12 00:29:01 -06:00
Rich Chiodo
06bc912e38
Save some memory in token creation (#7434)
* Save some memory in token creation

* Found another 200k

* Fix wrong way to check for undefined

* Back out unnecessary regex change

* Remove 'ExceedsMaxSize'
2024-03-11 09:30:48 -07:00
Eric Traut
6e73064841
Fixed a bug that results in a false positive under certain circumstances when defining a type alias using the old typing.TypeAlias annotation. This addresses #7457. (#7458) 2024-03-11 09:40:44 -06:00
Eric Traut
0ff8b5aa1f
Changed the behavior when accessing a class attribute from a generic class that is not specialized. The class is now automatically specialized in the case using default type parameter values (from PEP 696) or Unknown. This change is required for conformance with PEP 696. It addresses #7445. (#7454) 2024-03-11 00:51:05 -06:00
Eric Traut
33cab2aefe Fixed bug that resulted in a false positive under certain circumstances when a constrained TypeVar is used as the default for another constrained TypeVar. This addresses #7446. 2024-03-10 16:17:57 -06:00
Eric Traut
d1b2f3331b Fixed style issue. 2024-03-10 14:58:00 -06:00
Eric Traut
37ecc8d0bb Fixed bug that resulted in false negative when narrowing a constrained or bound TypeVar with a complex() or float() class pattern. This addresses #7449. 2024-03-10 14:30:45 -06:00
Eric Traut
1ff3820b34 Fixed bug that results in false positive when a generic class or type alias uses a TypeVarTuple followed by one or more ParamSpecs that have default values. This addresses #7444. 2024-03-10 13:47:23 -06:00
Eric Traut
bbd78d5090 Added check for generic classes and type aliases that include a TypeVarTuple followed by a TypeVar that has a default value. This is illegal according to PEP 696. This addresses #7443. 2024-03-10 12:41:44 -06:00
Eric Traut
1d658bb835 Fixed two bugs that resulted in false negatives when redefining a constant variable with a non-variable symbol and when redefining a Final variable with a non-variable symbol. This addresses #7440. 2024-03-09 18:07:57 -07:00
Eric Traut
209fac9a2c Enhanced handling of type function when it is passed a class. Pyright previously evaluated this as Any, but now it returns the class' metaclass. This addresses #7437. 2024-03-09 08:34:13 -07:00
Eric Traut
39960f39e4
Fixed a bug that resulted in an incorrect type evaluation when an augmented assignment is used within an inner-scoped function to add a constant to a variable. Literal math should not be used in this case. This addresses #7431. (#7436) 2024-03-08 21:59:50 -07:00
PylanceBot
a612aa9871
[PylanceBot] Pull Pylance with Pyright 1.1.353 (#7428)
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-08 11:06:09 -08:00
Eric Traut
114501e336 Published 1.1.353 2024-03-07 21:15:42 -07:00
Eric Traut
a434dfb535
Fixed bug that resulted in a false negative when a possibly-unbound variable is captured by an inner scope under certain circumstances. This addresses #7384. (#7427) 2024-03-07 20:12:20 -07:00
Eric Traut
38123df9e9
Fixed a bug that results in incorrect type narrowing behavior for member access expressions under certain circumstances. This addresses #7414. (#7426) 2024-03-07 18:38:38 -07:00
Eric Traut
34faf10e13 Removed inappropriate use of typeAtStart value in code flow engine. 2024-03-07 18:05:59 -07:00
Eric Traut
e39bc677af Further simplified interface to code flow engine. No functional change. 2024-03-07 18:05:59 -07:00
Erik De Bonte
6a8ae9215a
Show str method docstrings when called on LiteralString (#7388) 2024-03-07 13:10:27 -08:00
Eric Traut
bf0388ba57 Fixed a bug in the isinstance type guard logic. It was not properly handling tuples that included unions. This addresses #7422. 2024-03-07 13:45:13 -07:00
Eric Traut
1536aa5f4b Simplified interface to code flow engine by moving some parameters to options object. No functional change. 2024-03-07 01:13:27 -07:00
Eric Traut
aea1839e7b
Fixed hard-coded type information for module attribute __package__. It should be str | None rather than str. This addresses #7408. (#7409) 2024-03-06 09:23:07 -07:00
Eric Traut
e8e8464038 Fixed a regression that caused the signature help provider to not display the __new__ method of a constructor if it is overloaded. This addresses #7405. 2024-03-05 15:56:15 -07:00
Eric Traut
d58393b630 Updated documentation for "implied else". 2024-03-04 10:49:40 -07:00
Eric Traut
f27b71e236 Fixed a bug that results in incorrect type evaluation when an index expression is assigned a value within a doubly-nested loop under certain circumstances. This addresses #7381. 2024-03-03 14:11:26 -07:00
Eric Traut
9dce19cc87
Fixed a bug that results in a false positive error when expanding the type arguments to a TypeVarTuple under certain circumstances. This addresses #7389. (#7390) 2024-03-03 00:35:43 -07:00
Eric Traut
c64f9b3f1f
Improved support for instance variables whose type is declared in a metaclass. Pyright now honors this type and enforces type consistency in derived classes. This addresses #7372. (#7387) 2024-03-01 11:28:07 -07:00
Eric Traut
97267a53d6 Added check for inappropriate use of Annotated passed as second argument to NewType call. This addresses #7383. 2024-03-01 09:15:26 -07:00
Eric Traut
9fd49f6a13
Fixed a bug that leads to a false positive error when a match statement is used in a loop and the subject expression is potentially narrowed as a result of the match statement. This addresses #7371. (#7377) 2024-02-29 12:15:32 -07:00
Eric Traut
28e71ace0d
Fixed a bug that results in a false negative when a dundered method overrides a base class method of the same name and uses different parameter names along with different types. This addresses #7373. (#7376) 2024-02-29 10:54:40 -07:00
Rich Chiodo
ab402404b3
Drop support for node 12 (#7375)
* Drop support for node 12

* Forgot to update package-lock.json
2024-02-29 10:47:42 -07:00
Eric Traut
1f8fd8e2b0 Enabled PEP 705 and PEP 696 functionality without the use of enableExperimentalFeatures now that they are accepted. 2024-02-29 09:34:35 -07:00
Eric Traut
e19d1e7758 Fixed a couple of translation bugs for French. 2024-02-29 00:46:07 -07:00
Eric Traut
08397a0db3 Published 1.1.352 2024-02-28 16:59:21 -07:00
Eric Traut
3586183cd8 Updated closed TypedDict implementation to match latest thinking in typing forum. It is now generally agreed that a dict cannot be assigned to a closed TypedDict under any circumstance. https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items 2024-02-28 16:45:57 -07:00
Eric Traut
c81b09e595 Changed behavior of command-line "--pythonversion" and "--pythonplatform" options so they now override the same-named options in the config file. This addresses #7330. 2024-02-28 16:36:49 -07:00
Eric Traut
1c84fc0062
Fixed a bug that results in an incorrect "Unbound" type evaluation for a variable assigned within a loop. This addresses #7217. (#7361) 2024-02-28 00:45:13 -07:00
Eric Traut
495bd5b36f Fixed a bug that results in a false positive error when an await expression is passed as an argument to an overloaded function. This addresses #7222. 2024-02-28 00:22:46 -07:00
Eric Traut
8e184445e2
Fixed a bug in the import resolver that resulted in an incorrect resolution when an import within a __init__.py file uses the form from .a import a. This addresses #7233. (#7360) 2024-02-27 20:05:45 -07:00
Eric Traut
a8ee9f5554 Added missing check for inappropriate use of InitVar outside of a dataclass. 2024-02-27 18:52:11 -07:00
Eric Traut
afc6bca5ca
Refined the heuristic for when to use bidirectional type inference for the RHS of and and or operators. This addresses #7245. (#7348) 2024-02-26 14:25:05 -07:00