Commit Graph

7526 Commits

Author SHA1 Message Date
Erik De Bonte
727bce6c01
Pull Pylance with Pyright 1.1.357 (#7610) 2024-04-03 17:28:33 -07:00
Eric Traut
1eb0c99f2c Eliminated the need to retain a reference to the file contents in the parse tree. This helps pave the way for dropping the file contents altogether for memory savings. 2024-04-03 11:52:21 -07:00
Rich Chiodo
ed1dbe2132
Fix crash when imports are not resolved (#7608)
* Fix crash when imports are not resolved

* Fix other usages of resolvedPath
2024-04-03 11:23:11 -07:00
Eric Traut
8752be7a73 Published 1.1.357 2024-04-03 07:45:28 -07:00
Eric Traut
b6c8b7f73d Fixed a bug that results in incorrect inferred parameter types for an unannotated method in a subclass when the parent class method contains function-scoped TypeVars. This addresses #7606. 2024-04-03 07:41:55 -07:00
Rich Chiodo
4106a09001
Share heap usage numbers to support cache cleanup in VS code (#7605)
* Pass shared array buffer around for shared heap stats

* Put back skip logic for background analysis

* Review feedback
2024-04-02 16:49:40 -07:00
Eric Traut
5fd8830666
Refactored tokenizer and parser output to help reduce the amount of memory needed. (#7602) 2024-04-02 16:01:29 -07:00
Eric Traut
0b30e87de2 Improved return result for synthesized get method for closed TypedDict classes (as defined in PEP 728). 2024-04-02 07:47:16 -07:00
Eric Traut
dab9c8f20b Improved diagnostic message for access to unknown member in the case where the user probably meant to access an item in a TypedDict but used a member access expression rather than an index expression. This addresses #7579. 2024-03-31 22:31:06 -07:00
Eric Traut
2b29345060 Improved comment in completion provider. No functional change. 2024-03-31 22:30:05 -07:00
Eric Traut
7bc313e062
Fixed a bug that results in a false positive error when an unpacked TypeVarTuple is used in a function defined with PEP-695 syntax. This addresses #7588. (#7599) 2024-03-31 21:47:03 -07:00
Eric Traut
efb49124fb
Fixed inconsistent handling of literal values in a list comprehension. This addresses #7586. (#7598) 2024-03-31 16:15:11 -07:00
Eric Traut
b085a2669a Changed the handling of Final variables (that are not explicitly marked ClassVar) within dataclass class bodies. This is consistent with the runtime and [this proposed change to the typing spec](https://github.com/python/typing/pull/1669). 2024-03-31 15:07:14 -07:00
Eric Traut
7997351885
Enhanced discriminated class support to include not only literal field values but also None. This addresses #7590. (#7592) 2024-03-29 21:45:18 -06:00
Eric Traut
bf4ddb357b Updated documentation for #7590. 2024-03-29 21:40:57 -06:00
Eric Traut
e4f3d618d8 Fixed bug that results in a type not being narrowed when using the K in TD type guard pattern (where TD is a TypedDict and K is a literal key). Narrowing was skipped if the RHS operand was not a simple identifier. This addresses #7589. 2024-03-29 21:37:37 -06:00
Eric Traut
0668724375 Refactored createFunctionFromConstructor for readability and maintainability. No functional change. 2024-03-28 11:28:21 -06:00
Eric Traut
c29473ab0f Enhanced dictionary type evaluation to support dictionary items that overwrite previous dictionary items. Only the last value type is now considered, so if previous values (which are overwritten) would otherwise violate typing rules, this no longer generates a type error. 2024-03-27 21:56:26 -06:00
Eric Traut
8312bbee9d
Fixed a type hole when a dictionary expression includes a dictionary expansion operator that acts on a non-closed TypedDict. This addresses #7577. (#7582) 2024-03-27 21:33:06 -06:00
Eric Traut
fc41d35343
Fixed a bug that results in incorrect type narrowing of enums that derive from enum.Flag. In this case, we can't use enum expansion to a union of literals. This addresses #7576. (#7580) 2024-03-27 18:04:50 -06:00
Eric Traut
a33feda80f
Fixed bug that results in false negative when a __new__ or __init__ method cannot be bound without a type violation. This bug was found when writing a chapter on "constructors" for the typing spec. (#7573) 2024-03-27 11:56:52 -06:00
Eric Traut
436c72c0b7 Added support for negative (fall-through) type narrowing for subject subexpressions in match statement when subject consists of a tuple expression and patterns exhaustively match the tuple. This addresses #7568. 2024-03-27 09:51:26 -06:00
Eric Traut
b3723da1c5 Fixed bug that results in a false positive error when explicitly calling __new__ on a dataclass, namedtuple, or TypedDict. These classes all require synthesized __new__ methods. This addresses #7567. 2024-03-27 08:32:46 -06:00
PylanceBot
6652c4a818
pull-pylance-with-pyright-1.1.356-8444976018 (#7566)
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>
Co-authored-by: Stella Huang <stellahuang@microsoft.com>
Co-authored-by: Kacie Kang <jikang@microsoft.com>
2024-03-26 18:26:35 -07:00
Eric Traut
9f02004791 Published 1.1.356 2024-03-26 18:48:57 -06:00
Eric Traut
e9d923b739 Fixed bad link in documentation. 2024-03-26 14:06:02 -06:00
Federico Caselli
1f168130a7
Use a list for the configuration options (#7565) 2024-03-26 13:59:55 -06:00
Eric Traut
1001904ff5 Fixed a bug that results in a false positive reportImplicitOverride diagnostic if the class derives from an Unknown or Any class. This addresses #7560. 2024-03-26 08:28:44 -06:00
Eric Traut
6ef2ca1b27 Updated typeshed stubs to the latest version. 2024-03-25 17:31:40 -06:00
Heejae Chang
1110ff90e4
push pylance to pyright (#7558) 2024-03-25 14:50:25 -07:00
Eric Traut
7cf91f78a2 Changed the logic for metaclass instance variable lookups to ignore the lookup if the metaclass MRO contains an unknown class. This addresses #7556. 2024-03-25 09:02:06 -06:00
Eric Traut
fe41569755
Fixed a bug that results in a false positive when a class-scoped TypeVar used within a method has a default that refers to another class-scoped TypeVar. This addresses #7553. (#7554) 2024-03-24 16:03:00 -06:00
Eric Traut
69a9151674 Added check for the use of a non-runtime-checkable protocol class in a class pattern. This generates an exception at runtime. This addresses #7551. 2024-03-24 11:46:16 -06:00
Eric Traut
bb95091f1c
Fixed bug that results in incorrect type narrowing in the negative (fall-through) case when a runtime-checkable protocol class is used as a class pattern with arguments within a match statement. This addresses #7550. (#7552) 2024-03-24 11:41:24 -06:00
Eric Traut
3da27fd549 Fixed bug that resulted in a false positive error if a PEP-695 type statement uses a type parameter and encloses the RHS in quotes. This addresses #7538. 2024-03-21 14:12:49 -06:00
Erik De Bonte
a6e787fd4e
Use hex char codes and show code points for surrogate pairs (#7541) 2024-03-21 12:44:55 -07:00
Erik De Bonte
7f468b8c5b
Update Unicode range tables to match Unicode 15.1 (#7539) 2024-03-21 12:16:18 -07:00
Eric Traut
52a47010b9
Tweaked bidirectional type inference behaviors for lists to improve certain inference cases. This addresses #7527. (#7528) 2024-03-20 13:06:06 -06:00
Eric Traut
01eaa6fa64 Fixed bug that results in a false positive error when a class-scoped TypeVar with a default that references another class-scoped TypeVar is used in a method signature in that class. This addresses #7525. 2024-03-20 11:36:51 -06:00
Eric Traut
a2831b7338 Published 1.1.355 2024-03-20 00:07:43 -06:00
Eric Traut
8c0f8a968a
Fixed bug that results in false positive error when a __new__ method in a metaclass uses PEP 692 (unpacked TypeDict) to annotate its **kwargs parameter. This addresses #7514. (#7518) 2024-03-19 03:26:02 -06:00
Eric Traut
02a66c5e66
Expanded handling of python versions to handle more than just major/minor version numbers. Pyright now handles micro, releaseLevel, and serial numbers as well. This addresses #7132. (#7510) 2024-03-18 00:56:18 -06:00
Eric Traut
5a64ddfe5e
Fixed a bug that results in a false positive in a complex situation that involves generic protocols, properties, and mix-in classes. This addresses #7400. (#7506) 2024-03-17 10:36:21 -06:00
dependabot[bot]
6fd9d50b4a
Bump follow-redirects from 1.15.5 to 1.15.6 (#7504)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-17 00:13:27 -06:00
Eric Traut
c7beec11c2 Fixed bug that results in a false positive "overload implementation does not match overloads" diagnostic when positional-only and keyword-only parameters are involved. This addresses #7473. 2024-03-16 17:14:51 -06:00
Eric Traut
b0d18cff0c Fixed bug that results in a false positive error when a base class defines a writable property and a subclass writes to the property. This addresses #7478. 2024-03-16 13:22:12 -06:00
Eric Traut
cb2c493dab Fixed a bug that results in a false positive error in certain circumstances involving a TypeVarTuple used within an overload. This addresses #7502. 2024-03-16 13:14:06 -06:00
Eric Traut
0f9dc4758f
Fixed bug that results in a false negative when overriding a method that has keyword parameters with a method that has a *args parameter. This addresses #7480. (#7501) 2024-03-16 11:48:08 -06:00
Eric Traut
7320a6d31a
Improved validation for except and except* statements to catch some previously-undetected invalid cases. This addresses #7483. (#7500) 2024-03-16 10:28:55 -06:00
Eric Traut
8115955fae
Fixed bug that results in false positive when a list or set expression is evaluated using bidirectional type inference when the expected type is MutableSet or MutableSequence. This addresses #7498. (#7499) 2024-03-16 00:27:38 -06:00