Commit Graph

5849 Commits

Author SHA1 Message Date
Eric Traut
90f8653d03 Added a new check for a TypeGuard or StrictTypeGuard function that does not have at least one input parameter. This addresses https://github.com/microsoft/pyright/issues/4448. 2023-01-12 18:05:41 -08:00
Eric Traut
bfcf41c227 Fixed bug that led to a false positive when using method-scoped type variables in a type annotation for a cls parameter in a classmethod. This addresses https://github.com/microsoft/pyright/issues/4447. 2023-01-12 12:30:44 -08:00
Eric Traut
638eee8d94 Fixed a bug that resulted in an infinite loop when tuple addition was used within a loop construct. This addresses https://github.com/microsoft/pyright/issues/4424. 2023-01-11 19:46:45 -08:00
Eric Traut
8534bef686 Fixed bug that resulted in a false positive error when using the | operator to combine two set objects. This addresses https://github.com/microsoft/pyright/issues/4436. 2023-01-11 15:20:44 -08:00
Eric Traut
fa18230733 Fixed bug in dataclass_transform logic for frozen_default. If the frozen_default is set to True, it wasn't possible to override it with False explicitly. This addresses https://github.com/microsoft/pyright/issues/4444. 2023-01-11 14:58:49 -08:00
PylanceBot
bf8ec313b1
pull-pylance-with-pyright-null (#4443)
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-01-11 14:39:59 -08:00
Eric Traut
8de57a8e3e Fixed a bug in the truthy/falsy type guard logic when using self (or another bound TypeVar) where the bound class implements a __bool__ method. This addresses https://github.com/microsoft/pyright/issues/4439. 2023-01-11 09:59:33 -08:00
Eric Traut
46bf2fe11f Fixed a bug that causes incorrect interpretation of a large integer literal value — one that doesn't fit within a 53-bit mantissa. This addresses https://github.com/microsoft/pyright/issues/4435. 2023-01-10 21:59:13 -08:00
Eric Traut
336c61ad5e Fixed a bug that resulted in incorrect type evaluation for a callable attribute within a TypedDict or dataclass. If the attribute has no type annotation, it should be treated as a class variable, not an instance variable. This addresses https://github.com/microsoft/pyright/issues/4432. 2023-01-10 21:43:24 -08:00
Eric Traut
bc4381e8fe Published 1.1.288 2023-01-10 20:20:56 -08:00
Eric Traut
8388cb0a1d Add a bit more logging to try to better understand an assert_never that is appearing in the telemetry. 2023-01-10 12:54:49 -08:00
Eric Traut
09ce380899 Removed unnecessary function deleteTypeCacheEntry. Since type cache entries are always overwritten in these code paths, there's no need to explicitly delete them. 2023-01-08 18:40:47 -08:00
Eric Traut
9d71447609 Fixed a bug that resulted in a false positive error when a generic class used a contravariant type variable and defined a __new__ method that uses cls: type[Self] as a parameter. This addresses https://github.com/microsoft/pyright/issues/4421. 2023-01-08 14:31:31 -08:00
Eric Traut
452bd59778 Updated build instructions. 2023-01-08 09:20:12 -08:00
Eric Traut
ddc6932b9c Fixed a recent regression that that led to incorrect type evaluation for lambdas in certain cases. 2023-01-07 21:04:48 -08:00
Eric Traut
0caf09c511 Fixed a bug that resulted in incorrect isinstance type narrowing in certain cases when found within a loop construct. This addresses https://github.com/microsoft/pyright/issues/4419. 2023-01-07 18:55:42 -08:00
Eric Traut
4721364395 Fixed a bug in PEP 696 (TypeVar defaults) logic that resulted in a false positive error when a Self type was used within a generic method that also used a TypeVar with a default type. This addresses https://github.com/microsoft/pyright/issues/4418. 2023-01-07 17:59:47 -08:00
Eric Traut
c7ed87e18b Fixed a bug that led to a false negative when comparing a function without a *args to a callable type with a *args. This addresses https://github.com/microsoft/pyright/issues/4414. 2023-01-06 21:49:18 -07:00
Eric Traut
e8dc353f6d Fixed a bug that resulted in an incorrect type evaluation when calling a constructor on a class that uses new PEP 696 TypeVar defaults and provides an __init__ but no __new__. This addresses https://github.com/microsoft/pyright/issues/4417. 2023-01-06 20:04:05 -07:00
Eric Traut
a5b3ab2a37 Fixed a bug that resulted in a false positive error in certain cases when using PEP 695 type parameter syntax. 2023-01-06 18:41:47 -07:00
Eric Traut
b32eaa35f7 Fixed a recent regression that led to a false positive in certain cases when a call to a generic function was made within a loop. This addresses https://github.com/microsoft/pyright/issues/4415. 2023-01-06 13:00:17 -07:00
Eric Traut
b3f57edde8 Fixed a bug that resulted in a false positive when using heavily-nested call expressions that target overloads. The speculative type cache was not storing information about whether the type evaluation resulted in errors, so incorrect overloads were being chosen in the cached path. This addresses https://github.com/microsoft/pyright/issues/4403. 2023-01-05 11:03:47 -07:00
Heejae Chang
b78a9e4bd3
Push pylance changes to pyright (#4404)
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-01-04 14:07:31 -08:00
Eric Traut
ca078abc07 Added support for NoneType to be used in an isinstance type guard or match statement. This addresses https://github.com/microsoft/pyright/issues/4402. 2023-01-04 12:57:41 -07:00
Christian Clauss
544779871a
Upgrade GitHub Actions (#4400)
* https://github.com/actions/cache/releases
* https://github.com/actions/checkout/releases
* https://github.com/actions/setup-node/releases
2023-01-04 11:06:05 -07:00
Christian Clauss
bd3ac8b722
Fix typos discovered by codespell (#4399) 2023-01-04 06:54:43 -07:00
Eric Traut
c7626944f1 Added support for type guard forms x is ..., x is not ..., x == ... and x != .... Support for these were recently added to mypy. This addresses https://github.com/microsoft/pyright/issues/4397. 2023-01-04 06:13:44 -07:00
Christian Clauss
7be1d77360
Fix typo (#4398) 2023-01-04 05:53:27 -07:00
Eric Traut
fb563dbe24 Fixed a bug that resulted in a false positive error when accessing __required_keys__ and __optional_keys__ class variables from a TypedDict class. This addresses https://github.com/microsoft/pyright/issues/4396. 2023-01-04 05:49:23 -07:00
Eric Traut
440d54d68d Published 1.1.287 2023-01-03 23:54:58 -07:00
Eric Traut
f3e93a54fe Fixed a bug that led to a false positive error when using a custom __or__ operator on a generic class. This addresses https://github.com/microsoft/pyright/issues/4395. 2023-01-03 09:17:57 -07:00
dependabot[bot]
b8505d8a0e
Bump json5 from 2.2.1 to 2.2.3 (#4392)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-03 07:24:15 -07:00
Eric Traut
d48b124719 Fixed a bug that resulted in a false positive error when resolving nested overloaded function calls where the correct overload match depends on bidirectional type inference. This addresses https://github.com/microsoft/pyright/issues/4391. 2023-01-02 17:27:56 -07:00
Eric Traut
0d640b96a2 Improved error reporting for type mismatch involving a return type that is a TypedDict. This addresses https://github.com/microsoft/pyright/issues/4390. 2023-01-02 00:46:55 -07:00
Eric Traut
e3861df6b9 Fixed recent performance regression in type evaluator. This addresses https://github.com/microsoft/pyright/issues/4389. 2023-01-01 12:08:00 -07:00
Eric Traut
9f2ff19856 Small code cleanup. 2023-01-01 03:02:35 -07:00
Eric Traut
cb367a1fdb Addressed type evaluation performance issue by eliminating separate "incomplete type cache" and combining it with the primary type cache. This addresses https://github.com/microsoft/pylance-release/issues/3668#issuecomment-1326852434. 2022-12-31 17:53:19 -07:00
Eric Traut
48156fd3e3 Removed unnecessary complexity related to incomplete type cache. 2022-12-31 16:11:36 -07:00
Eric Traut
90c6d482bf Minor code cleanup. Moved a few types from typeCache module into codeFlowEngine. 2022-12-31 15:32:37 -07:00
Eric Traut
669fbfd44f Fixed a bug in the import cycle detection logic that led to some false negatives. This addresses https://github.com/microsoft/pyright/issues/4388. 2022-12-30 12:40:38 -07:00
Eric Traut
c588f922f1 Fixed bug that sometimes resulted in incorrect type evaluation of tuple expressions used within a loop. This addresses https://github.com/microsoft/pyright/issues/4386. 2022-12-30 01:59:42 -07:00
Eric Traut
2854d7e8a1 Fixed regression that caused an incorrect type evaluation in the presence of a doubly-nested loop. This addresses https://github.com/microsoft/pyright/issues/4383. 2022-12-29 10:40:25 -07:00
Eric Traut
ccc17c8b66 Fixed false positive error in parser when an assignment expression (walrus operator) is used in a subscript list without parentheses. This was a syntax error in Python 3.8 and 3.9 but is allowed in 3.10 and newer. 2022-12-28 09:08:56 -07:00
Eric Traut
5e83e8182a Updated README to include PEP 696. 2022-12-27 22:16:10 -07:00
Eric Traut
e4472b3275 Published 1.1.286 2022-12-27 22:01:39 -07:00
Eric Traut
101cab9594 Fixed bug in handling of TypeVar default types that use a bound TypeVar. 2022-12-27 22:01:26 -07:00
Eric Traut
9e6a22e233 Added error handling for PEP 696 to check for the case where a TypeVarLike without a default type is found after a TypeVarLike with a default type in a parameter list. 2022-12-27 16:28:57 -07:00
Eric Traut
52e482f48b Added support for PEP 696 (type variable default types) where one type var default depends on other type variables in the same scope. 2022-12-27 15:57:55 -07:00
Eric Traut
76250bb3a8 Completed simplification of TypeVarContext by eliminating separate ParamSpec map. ParamSpec values are all now stored in TypeVarContext as function types. 2022-12-27 14:35:15 -07:00
Eric Traut
a7a3c00169 Changed convertTypeToParamSpecValue to always return a value. This is step in simplifying the type var context. 2022-12-27 12:43:57 -07:00