Commit Graph

5618 Commits

Author SHA1 Message Date
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
Eric Traut
6b986e4abf Removed ParamSpecEntry as first step toward simplifying the type var context. 2022-12-27 12:39:39 -07:00
Eric Traut
5ea4f1fa5a Added support for PEP 696 (default type variables) when default values refer to other type variables and are used with generic functions. 2022-12-27 11:52:00 -07:00
Eric Traut
5701977843 Changed applySolvedTypeVar to accept an options object. This cleans up the interface and allows for easy addition of more options in the future. 2022-12-27 10:40:45 -07:00
Eric Traut
24fc9a7047 Added a few more tests for default type vars used in class definitions. 2022-12-27 10:39:08 -07:00
Eric Traut
a2746d2735 Reorganized PEP 696 tests. 2022-12-27 08:05:51 -07:00
Eric Traut
52a19aa9ab Added support for PEP 696-style default type argument values using PEP 695 syntax for generic classes. 2022-12-27 01:30:02 -07:00
Eric Traut
2759fbb2b1 Added support for default TypeVar types that refer to other TypeVars. 2022-12-26 20:52:19 -07:00
Eric Traut
cd40941599 Improved error handling for NewType calls. This addresses https://github.com/microsoft/pyright/issues/4374. 2022-12-26 00:19:34 -07:00
Eric Traut
775b7b4d85 Improved handling of TypeVars that appear only within a Callable within a return type annotation for a function. By a strict reading of PEP 484, these should be bound to the function's scope, but practically, they are bound to the Callable. This allows a function to return a generic callable type. When TypeVars are rescoped in this manner, the TypeVar cannot be referenced within the function body because it is no longer in scope in that context. This addresses https://github.com/microsoft/pyright/issues/4285. 2022-12-25 10:57:02 -07:00
Eric Traut
8ae0cc1336 Minor code cleanup. No functional change. 2022-12-25 10:54:18 -07:00
Eric Traut
d32c630bff Removed unused localized string. 2022-12-25 10:53:55 -07:00
Eric Traut
cb44ed69d1 Improved the method override consistency checks to detect the case where an override uses an *args parameter that is not type compatible with the overridden method's parameter types. Thanks to @mehdigmira for this contribution. This addresses https://github.com/microsoft/pyright/issues/4118. 2022-12-25 01:33:55 -07:00
Eric Traut
3e755c46c4 Improved mechanism for determining type parameters for a generic function. 2022-12-25 01:17:46 -07:00
Eric Traut
bba6b5ec8b Fixed a bug in the code flow engine that resulted in incorrect type evaluation in some cases involving double nested loops. This addresses https://github.com/microsoft/pyright/issues/4040. 2022-12-24 00:14:33 -07:00
Eric Traut
23a1f1f5b6 Improved handling of generic functions passed as arguments to generic higher-order functions that use a ParamSpec. Pyright is now able to solve the type variables for both the generic callback and the called function. This addresses https://github.com/microsoft/pyright/issues/4371. 2022-12-23 17:05:27 -07:00
Eric Traut
84f35a9d50 Updated typeshed stubs to the latest version. 2022-12-23 15:26:34 -07:00
Eric Traut
92e04e5d21 Improved handling of generic functions passed as arguments to generic higher-order functions. Pyright is now able to solve the type variables for both the generic callback and the called function. This addresses https://github.com/microsoft/pyright/issues/4281 and https://github.com/microsoft/pyright/issues/2070. 2022-12-23 14:59:12 -07:00
Eric Traut
d905379703 Renamed some types and methods on the typeVarContext module for clarity. No functional change. 2022-12-23 14:03:46 -07:00
Eric Traut
8efb85e710 Fixed a bug that led to a false negative during protocol matching if the protocol class refers to itself within an invariant type argument. 2022-12-22 16:04:14 -07:00
Eric Traut
c74647c2fa Improved handling of TypeVarTuple constraint solving. Previously, if a TypeVarTuple appeared more than once, the corresponding tuple types needed to be identical. The constraint solver now supports the same sort of narrowing/widening within the tuple entries to find the best solution. This addresses the second part of https://github.com/microsoft/pyright/issues/4279. 2022-12-22 13:43:30 -07:00
Eric Traut
feebd227fe Fixed a bug that caused target expressions within a chained assignment to be evaluated in the wrong order (right to left instead of left to right). This resulted in false positives and negatives in some cases where one target referred to another target. This change also makes it illegal to use a Python 2-style type comment on a line containing a chained assignment statement, reflecting the fact that Python 3-style variable type annotations are not legal here either. This addresses https://github.com/microsoft/pyright/issues/4368. 2022-12-22 10:06:16 -07:00
Eric Traut
10d21c54b9 Fixed a bug that resulted in incorrect handling of literals in the TypeVar constraint solver. This involved a pretty significant change to the constraint solver logic — one that eliminated some heuristics and special cases. This addresses part of https://github.com/microsoft/pyright/issues/4279. 2022-12-22 01:09:18 -07:00
Eric Traut
8fff7a816f Removed unnecessary code in the code path that handles type compatibility checks between two functions. 2022-12-21 20:05:40 -07:00
Eric Traut
00dcb33c99 Revert "Updated TOML parser to one that is compliant with the TOML 1.0 spec. This addresses https://github.com/microsoft/pyright/issues/4336."
This reverts commit d046f160a6.
2022-12-21 14:02:40 -07:00
Eric Traut
0be873e289 Fixed a couple of typos in the documentation. 2022-12-21 10:47:28 -07:00
Eric Traut
5c0de8b79b Published 1.1.285 2022-12-21 01:17:53 -07:00
Eric Traut
69cdd4aa40 Fixed a bug that resulted in a false positive error when a property setter or deleter contained function-scoped type variables. This addresses https://github.com/microsoft/pyright/issues/4293. 2022-12-21 00:27:16 -07:00
James Duley
fd50e8314d
Make reportImportCycles work again (#4356) 2022-12-19 05:58:24 -08:00
Eric Traut
97b6231d13 Added a few more minor improvements to the docs. 2022-12-18 18:40:29 -08:00
Jelle Zijlstra
355361e8b3
fix typos in mypy-comparison (#4354)
* fix typos in mypy-comparison

* fix versions
2022-12-18 18:15:17 -08:00
Eric Traut
e3ddbb3171 Small tweaks to the new documentation based on proofreading pass. 2022-12-18 15:24:59 -08:00