Commit Graph

7285 Commits

Author SHA1 Message Date
Eric Traut
cfefcf49f5 Updated typeshed stubs to the latest version. 2024-04-06 17:50:34 -07:00
Eric Traut
628e246887
Fixed a bug that results in a false positive error under certain circumstances when a TypeVar or TypeVarTuple is being solved with literal values in both an invariant and non-invariant context. This addresses #7562. (#7629) 2024-04-06 14:41:22 -07:00
Eric Traut
4149eb3eda
Fixed bug that results in an intermittent false positive "circular dependency" error for fields within a dataclass. This addresses #7516. (#7625) 2024-04-05 22:03:03 -07:00
Eric Traut
39dfca8acd Added accessor method for class symbol table. This is in preparation for a bug fix for #7516. 2024-04-05 21:52:53 -07:00
Eric Traut
6d1a5fd9f7
Added support for narrowing of subject subexpression within a match statement for references to the subexpression after the completion of the match statement. This addresses #7620. (#7621) 2024-04-04 23:05:55 -07:00
Eric Traut
627d3ded61 Modified the handling of enum class attributes so those with private (mangled) names are exempted from being considered enum members. This reflects the runtime behavior. This addresses #7619. 2024-04-04 16:47:01 -07:00
Eric Traut
aff916f0cd Added optimization for TypedDict type assignments. Under certain circumstances (e.g. when comparing large unions of TypedDict types), this can save significant time. This addresses #7617. 2024-04-04 14:43:56 -07:00
Eric Traut
476447cb65
Fixed a bug that results in incorrect type evaluation when a sequence pattern in a match statement includes a * element and the subject includes a tuple with an element with indeterminate length. This addresses #7613. (#7616) 2024-04-04 10:06:35 -07:00
Eric Traut
26db037205 Fixed non-compliance issue with TypeIs, which is documented to have an invariant type parameter. This addresses #7615. 2024-04-04 08:27:31 -07:00
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