Commit Graph

5274 Commits

Author SHA1 Message Date
Eric Traut
85651bd849 Renamed "in-scope placeholder type variables" to "unification variables". No functional change. 2024-07-29 20:59:05 -07:00
Eric Traut
67f0b8d173
Simplified some of the logic involved in type var constraint solving. (#8594) 2024-07-29 20:50:55 -07:00
Eric Traut
4d2d197bff
Started to simplify some of the code involved in type var solving. (#8590)
Improved handling of type variable matching when a callee's parameter is a union of two or more "naked" type variables (like `S | T`).
2024-07-29 17:30:33 -07:00
Eric Traut
173ced142d
Fixed bug that can result in a false positive when calling the constructor within a class that has unannotated __init__ or __new__ method parameters. (#8582) 2024-07-29 11:03:28 -07:00
Eric Traut
e99b7726c8
Fixed bug that can result in a false negative when a function return type is a TypeVar and the function falls through and implicitly returns a None. (#8581) 2024-07-29 10:46:58 -07:00
Eric Traut
c2f5d26f03
Adjusted the heuristics for constraint solving to favor solutions of type T over type[T]` when both are valid. (#8579) 2024-07-28 22:26:34 -07:00
Eric Traut
cfd1a3710a Fixed bugs in a few test cases. 2024-07-28 13:19:58 -07:00
Eric Traut
f306d366dd
Modified heuristics in T is None type narrowing logic to handle TypeVars with no bounds better. The previous logic was arguably correct, but it produced results that were unexpected by some users. This addresses #8575. (#8578) 2024-07-28 10:36:47 -07:00
Eric Traut
d3d24d35bd
Added convenience accessor functions for TypeVars to test for constra… (#8576)
* Added convenience accessor functions for TypeVars to test for constraints, bounds, and Self. No functional change.

* Fixed style issue
2024-07-28 09:01:30 -07:00
Eric Traut
7e8dfb76ad Added support for @deprecated on __new__ methods used implicitly during a class constructor call. This addresses #8574. 2024-07-28 08:11:38 -07:00
Eric Traut
513d2ea697
Added support for @deprecated on __bool__ magic method used by not operator. (#8573) 2024-07-27 23:17:23 -07:00
Eric Traut
ed679c69d3
Added support for @deprecated decorator on magic methods for unary and binary operations. (#8572) 2024-07-27 22:42:20 -07:00
Eric Traut
5d68698462
Fixed bug that results in a false negative if a __set__ descriptor method is marked deprecated and is implicitly accessed using an augmented assignment operator, as in a.x += 1. (#8571) 2024-07-27 21:57:49 -07:00
Eric Traut
3931155adb
Fixed recent regression that can lead to a crash. (#8570) 2024-07-27 21:49:13 -07:00
Eric Traut
28b5427d55 Renamed some concepts in the typeVarContext and constraintSolver modules in preparation for a larger change. 2024-07-27 15:44:03 -07:00
Eric Traut
5397ee3470 Removed import cycle in typeVarContext module. 2024-07-27 14:58:53 -07:00
Eric Traut
bffbc33b69 Cleaned up data structures for TypeVarType to provide better type protection for ParamSpec and TypeVarTuple fields. Renamed TypeVarTuple test cases to conform better to internal terminology.
(cherry picked from commit 0a15f335ec5bba5f1b0997ffec4c622dad74bf13)
2024-07-27 14:52:58 -07:00
Eric Traut
01a82e2023 Renamed some internal symbol names for brevity (parameter => param). No functional change. 2024-07-27 12:03:36 -07:00
Eric Traut
a74871d46f Simplified cloneForSpecialization call to improve brevity and readability. 2024-07-27 11:21:49 -07:00
Eric Traut
8cab57e657 Renamed some internal symbol names for brevity (argument => arg). No functional change. 2024-07-27 11:02:57 -07:00
Eric Traut
31df557056 Removed some unused functionality from the TypeVarContext. 2024-07-27 10:39:52 -07:00
Eric Traut
4b91a0b222 Moved type complexity calculation into its own module. 2024-07-27 10:31:13 -07:00
Eric Traut
2c4032a920 Simplified TypeVarContext by removing some of the special-case handling for tupleTypeArgs. 2024-07-27 10:20:33 -07:00
Eric Traut
2bbd1bf288
Fixed a bug that can result in incorrect type evaluation when an isinstance type narrowing results in an intersection type. (#8564) 2024-07-27 10:17:05 -07:00
Eric Traut
7e7ad07453
Removed special-casing for None that is no longer needed. (#8562) 2024-07-26 21:04:49 -07:00
Eric Traut
c385edf274
Added missing check for Final variable assigned in a loop. (#8561) 2024-07-26 17:08:24 -07:00
Eric Traut
5f145eb010
Fixed a bug that results in incorrect type narrowing when tuples are used in conjunction with TypeIs. This addresses #8554. (#8559) 2024-07-26 16:14:37 -07:00
Eric Traut
87609b7f43 Refactored some functionality out of the type evaluator into a new tuples.ts module. 2024-07-26 14:00:16 -07:00
Eric Traut
93ce674190 Refactored code that creates pseudo-intersection types for isinstance type narrowing. No functional change. 2024-07-26 13:22:13 -07:00
Eric Traut
b076b783cb
Fixed a bug that results in an incorrect "inconsistent overload" error when the overloads return TypeIs or TypeGuard and the implementation returns bool. This addresses #8521. (#8556) 2024-07-26 11:53:40 -07:00
Eric Traut
a1f24db683
Fixed recent regression that results in a false positive error under certain circumstances when yield expression includes a call to a constructor. This addresses #8552. (#8553) 2024-07-26 09:49:37 -07:00
Eric Traut
28b452ac0f Simplified previous commit. 2024-07-25 20:34:19 -07:00
Eric Traut
5cea702a7e
Enhanced type narrowing for sequence patterns to support tuple expansion when the subject is a tuple whose entries are union types. This addresses #8516, #4995, #6437, and #7472. (#8547) 2024-07-25 20:21:13 -07:00
Eric Traut
06d28c39d5
Added a new configuration option enableReachabilityAnalysis. It is off by default when typeCheckingMode is "off" but otherwise on by default. When disabled, it causes pyright not to identify code blocks that are determined to be unreachable via type analysis. Code blocks that are determined to be unreachable via non-type information are still displayed as such. (#8546) 2024-07-25 19:13:15 -07:00
Eric Traut
5dd321a280
Fixed false positive error when iterator returns a class object from its __iter__ method. (#8545) 2024-07-25 17:48:03 -07:00
Eric Traut
4c3def9bbc
Added error check for an enum attribute with a "naked" Final attribute. This should be considered invalid. This addresses #8543. (#8544) 2024-07-25 17:00:53 -07:00
Eric Traut
95be64edeb
Updated code flow engine to distinguish between code that is unreachable based on type information and non-type information. (#8541) 2024-07-25 14:38:32 -07:00
Heejae Chang
ee42447964
push pylance to pyright 2024.8 (#8540)
* push pylance to pyright 3

* change config change back

* dont run some tests in real venv
2024-07-25 13:38:32 -07:00
Eric Traut
033ca1909b
Removed a bunch of redundant code related to annotation evaluation. (#8538) 2024-07-25 12:14:19 -07:00
Eric Traut
00ca6c38e8
Eliminated error condition when using a subscript expression for a generic class that does not conform to type expression rules (e.g. list[1 + 2]) if the expression is a value expression. This addresses #8534. (#8537) 2024-07-25 11:07:48 -07:00
Eric Traut
8f9f679a26
Changed evaluation behavior for TypeVar bounds, constraints, and defaults to enforce type expression evaluation rules, consistent with the typing spec. (#8536) 2024-07-25 10:41:30 -07:00
Eric Traut
6750ce5d74
Fixed recent regression that results in a false positive error when evaluating certain nested constructor calls when used with bidirectional type inference. This addresses #8519. (#8535) 2024-07-25 08:59:40 -07:00
Eric Traut
d20a0a2644
Fixed bug that results in a warning if the self parameter in an __init__ method is given an explicit Self annotation. This addresses #8532. (#8533) 2024-07-25 07:55:56 -07:00
Eric Traut
785d21962a
Fixed recent regression that results in incorrect isinstance type narrowing when the filter class and the type are both protocols. This addresses #8518. (#8529) 2024-07-24 17:06:52 -07:00
Eric Traut
d602f22098 Improved signature help for constructor calls. Replaced old heuristics that displayed either the __init__ or __new__ signature with a mechanism that uses the recently-ratified typing spec algorithm for converting a constructor into a callable. This is prompted in part by [this discussion](https://discuss.python.org/t/copying-signature-of-init-to-a-mixin-class-method/58907/2). 2024-07-24 16:10:48 -07:00
Eric Traut
385c84cce3 Fixed a bug that results in a crash in certain conditions involving a corrupt builtins.pyi stub. This addresses #8509. 2024-07-24 13:06:52 -07:00
Eric Traut
2cbd8752b4
Fixed bug in isinstance type narrowing if the second argument is object and the first argument is a type instance. This addresses #8520. (#8527) 2024-07-24 13:05:39 -07:00
Eric Traut
d833078226 Fixed bug that results in a crash if Optional is used with no subscript (i.e. Optional[]). This addresses #8524. 2024-07-24 12:24:00 -07:00
Eric Traut
21bfd0f5bb
Fixed bug in logic that validates subtyping relationships between TypeIs[T], TypeGuard[T] and bool when used in a return type of a callable. This addresses #8521. (#8523) 2024-07-24 10:26:58 -07:00
Eric Traut
258e2754bd Published 1.1.373 2024-07-23 17:06:24 -07:00
Eric Traut
77684ec7fc
Added support for auto-synthesized __replace__ method in dataclass … (#8514)
* Added support for auto-synthesized `__replace__` method in dataclass and namedtuple classes, a new feature in Python 3.13. This addresses #8300.

* Fixed broken test on Linux due to file system case sensitivity.
2024-07-22 22:31:18 -07:00
Eric Traut
39757e4519
Updated typeshed stubs to the latest version. (#8512) 2024-07-22 20:57:57 -07:00
Eric Traut
408b20b6c5
Eliminated a fragile assumption that Sequence and MutableSequence are nominal classes rather than protocols. This assumption holds today, but it might not in the future, and the pattern matching logic shouldn't rely on it. (#8510) 2024-07-22 20:15:53 -07:00
Eric Traut
ea8188fc77 Fixed bug that results in a crash if an explicit specialization of a class parameterized by a ParamSpec has zero type arguments. This is a syntax error, but it shouldn't cause the type evaluator to crash. 2024-07-22 12:23:36 -07:00
Eric Traut
616b2a5eea
Added support for bidirectional type inference for __extra_types__ in a closed TypedDict. This addresses #8503. (#8507) 2024-07-22 07:14:40 -07:00
Eric Traut
b9d25687f4
Fixed issues with the reportInconsistentConstructor. It produced false negatives in some cases and produced bad error messages in other cases. This addresses #8501 and #8500. (#8502) 2024-07-21 00:06:36 -07:00
Eric Traut
e812172ecf
Removed redundant assignment flag. (#8499) 2024-07-20 19:17:47 -07:00
Eric Traut
79959e7f6f Shortened some internal names for readability. No functional change. 2024-07-20 18:49:21 -07:00
Eric Traut
c2a1d6a99a Made support for "converter" parameter in dataclass_transform fields non-experimental. This functionality has been approved by the typing council. 2024-07-19 22:37:48 -07:00
Eric Traut
bf4c521c67 Added test case for #8494, which was already fixed by a previous commit. 2024-07-19 20:20:12 -07:00
Eric Traut
7434085425
Simplified check of the __init__ method by leveraging common code. (#8495) 2024-07-19 20:14:14 -07:00
Eric Traut
3f4235e965 Removed recently-added finally because it gets in the way of debugging. 2024-07-19 13:08:55 -07:00
Eric Traut
a508fad80e
Fixed a bug that can cause a hang during type analysis for complex code with loops. There are rare circumstances that can cause types not to converge due to symbol dependencies and unstable overload resolution. This change adds a hard limit on the number of attempts to converge types in a loop before giving up. It addresses #8279. (#8491) 2024-07-19 11:28:54 -07:00
Eric Traut
3b5aba31df
Fixed bug that resulted in an infinite loop when evaluating a call that passes the same call as an argument. Simplified tracking of unique signatures within the code. This addresses #8047. (#8488) 2024-07-18 23:10:02 -07:00
Eric Traut
0eeffb0ab2
Improved type evaluation for tuples index expressions with negative subscripts and an entry with an indeterminate length. This addresses #8485. (#8486) 2024-07-18 19:22:37 -07:00
Eric Traut
7554fea844
Fixed bug that results in a false positive "overlapping overload" diagnostic when the later overload includes a callback function with a TypeVar in a parameter type. This addresses #8465. (#8484) 2024-07-18 19:18:28 -07:00
Eric Traut
405e6288cb
Fixed a bug that results in incorrect type narrowing when using TypeIs form when the return type of the type guard function is a specialized generic class. This addresses #8460. (#8483) 2024-07-18 16:35:10 -07:00
Eric Traut
55f1f5f6a8
Added the distinction between "external" versus "internal" type variable scopes. This is important for generic class implementations that call their own constructors. (#8482)
This is a significant change with high potential for regressions.

It addresses #8165, #7988, #7507, #7369.
2024-07-18 14:33:02 -07:00
Eric Traut
90b1bfbd34
Added check for class attribute type declarations that use method-bound type variables. These should be illegal. This addresses #8479. (#8480) 2024-07-18 12:17:45 -07:00
Eric Traut
20d985f007
Changed internal behavior to retain type alias information when applying solved type variables for a type. (#8476) 2024-07-18 09:38:50 -07:00
Eric Traut
f4ac69bf05
Added some additional improvements and tests from another working branch. (#8474) 2024-07-18 08:40:34 -07:00
Eric Traut
c6a449d1a1
Added a small optimization for the previous change to bidirectional inference for call expressions. (#8472) 2024-07-18 08:17:34 -07:00
Eric Traut
42c379bbb8 Added provisional support for draft PEP 736 (keyword argument shortcut syntax). This addresses #8470. 2024-07-18 01:13:42 -07:00
Eric Traut
1d9b8b5ece
Fixed a bug that results in a false positive error when using bidirectional type inference for a call expression where the expected type is a union. This addresses #8449 and #8463. (#8468) 2024-07-17 20:27:16 -07:00
Eric Traut
c116e6af19
Fixed a bug that results in incorrect type evaluation in certain edge cases involving bidirectional type inference with TypeVarTuples. (#8461) 2024-07-17 16:37:23 -07:00
Eric Traut
25cfdf7fcf
Changed all diagnostic generated in the type evaluator to have a diagnostic rule associated with them so their severity is under user control. This addresses #8453. (#8456) 2024-07-17 12:10:33 -07:00
Eric Traut
60c3b168a7
Fixed regression that results in a false positive when an Annotated type is used in a type argument within a specialized type on the LHS of a call expression, such as list[Annotated[int, ""]](). This addresses #8454. (#8455) 2024-07-17 11:57:56 -07:00
Eric Traut
d6372d4570 Published 1.1.372 2024-07-16 18:39:04 -07:00
Eric Traut
f5edd2b85d
Added some changes from another branch. (#8445)
Added some changes from another branch.
2024-07-16 12:50:25 -07:00
Eric Traut
5d6b96bc60
Incorporated several bug fixes and cleanups from an alternate branch. (#8443) 2024-07-16 11:13:20 -07:00
Eric Traut
e78b3b87f7
Refactored the code for TypeVar scope ID assignment to improve readability and maintenance. (#8440) 2024-07-15 16:47:10 -07:00
Eric Traut
baf6572b41
Fixed false positive error when using an overloaded __init_subclass__ method under certain circumstances. This addresses #8436. (#8439) 2024-07-15 15:08:26 -07:00
Eric Traut
b470f3e4d2
Changed logic for explicit specialization to allow Never as a type argument for a value-constrained type parameter if Never is an explicit constraint. This addresses #8432. (#8438) 2024-07-15 13:05:07 -07:00
Eric Traut
86869f0c94
Added "literal math" support for exponentiation operator. This addres… (#8437)
* Added "literal math" support for exponentiation operator. This addresses #8434.

* Refactored binary ops "literal math" code for maintainability and readability.
2024-07-15 12:49:45 -07:00
Eric Traut
042d2ea582
Fixed bug that results in some circumstances in incorrect specialization of type[T] when T evaluates to Any. This addresses #8429. (#8431) 2024-07-14 23:40:44 -07:00
Eric Traut
6990c98c12
Further simplified bidirectional inference logic for calls. (#8427) 2024-07-14 14:37:31 -07:00
Eric Traut
3bf626b020
Improved and simplified then handling constructor calls for classes t… (#8426)
* Improved and simplified then handling constructor calls for classes that have no `__init__` or `__new__` method.

* Removed unused localized string.
2024-07-14 11:34:56 -07:00
Eric Traut
89341d308d
Improved the handling of bidirectional type inference for call expressions when the expected type comprises a union. (#8425) 2024-07-14 11:07:16 -07:00
Eric Traut
b88e3dcef2
Incorporated some code cleanup changes from another working branch. (#8424) 2024-07-14 10:46:07 -07:00
Eric Traut
426fe55611
Fixed bug that results in a false positive error under certain circumstances when a generator function with no type annotation contains a return value. This addresses #8421. (#8422) 2024-07-14 09:01:52 -07:00
Eric Traut
9daf584ba4
Added "literal math" support for bitwise operators (left shift, right shift, logical or, logical and, logical xor, and invert). This addresses #8419. (#8420) 2024-07-13 23:09:16 -07:00
Eric Traut
f72be7b6b4 Added optimization to monomorphize objects used in the code flow engine. 2024-07-13 20:59:39 -07:00
Eric Traut
1e218a2cfe
Fixed inconsistent behavior when evaluating a binary expression with an or or and operator when the LHS evaluates to a literal int, str, bytes or bool type. This addresses #8417. (#8418) 2024-07-13 20:09:56 -07:00
Eric Traut
5192889fb5 Renamed fields in parse nodes to reduce verbosity and increase consistency. 2024-07-13 17:48:02 -07:00
Eric Traut
210bb144d7
Modified parser data structures to make parse nodes monomorphic and improve performance. (#8416) 2024-07-13 17:45:13 -07:00
Eric Traut
5ac7f49a3f Eliminated maxChildDepth field from parse nodes. 2024-07-13 15:55:32 -07:00
Eric Traut
496822d3d0
Modified typing data structures to increase monomorphism for performance reasons. (#8415) 2024-07-13 14:43:45 -07:00
Eric Traut
17bd81a7de
Next step in attempting to make typing types monomorphic. (#8413) 2024-07-13 12:35:34 -07:00
Eric Traut
d2d0fdcd23
Did a small refactor of the FunctionType interface and eliminated a field. (#8412) 2024-07-13 10:50:07 -07:00
Eric Traut
2f1bce7b25
Fixed a bug that results in incorrect import resolution behaviors when a ".py" file and a directory have the same name, and the directory doesn't have a __init__.py file in it. In this case, the ".py" file should take precedence during imports. This addresses #8408. (#8410) 2024-07-13 09:50:07 -07:00
Eric Traut
897081901e
Did some refactoring and code cleanup in import resolver in preparation for a bug fix. (#8409) 2024-07-13 09:27:41 -07:00
Eric Traut
47ea13bc2d
Changed the type of the __doc__ attribute for a module to always be str | None. Previously, pyright changed its declared type to str if a docstring was present in the module, but this is incorrect because it's a writable value and can be set to None. This addresses #8388. (#8397) 2024-07-12 10:58:20 -07:00
Eric Traut
96ee9c6268
Changed union creation logic to retain (rather than elide) redundant literals in some cases. In particular, for type expressions that explicitly include literals along with their non-literal counterpart like Literal[1] | int. Retaining these redundant subtypes can be useful for language server features like completion suggestions. This addresses #8392. (#8396) 2024-07-12 09:52:22 -07:00
Eric Traut
30e139b5f8
Fixed a bug that results in a false positive reportOverlappingOverload error in certain cases involving ParamSpec and Concatenate. This addresses #8389. (#8393) 2024-07-12 08:51:34 -07:00
Eric Traut
71928e1b00
Changed the way FunctionParam objects are created so they are monomorphic. (#8387) 2024-07-12 00:02:29 -07:00
Eric Traut
2f88f837d0
Did some code cleanup in the types module. Eliminated a few unnecessary optional fields in common objects. (#8386) 2024-07-11 21:51:36 -07:00
Eric Traut
a740945cd7 Removed the builtinName field from FunctionType. It can be represented by a flag more economically. 2024-07-11 20:49:26 -07:00
Eric Traut
2dffecb0f2
Added support for class declarations within an enum class body -- both with and without @member and @nonmember decorators. This addresses #8366. (#8385) 2024-07-11 20:31:19 -07:00
Eric Traut
827684ac2e
Fixed a bug that results in false positive reportInconsistentConstructor errors if one or both of __init__ or __new__ are overloaded. This addresses #8372. (#8383) 2024-07-11 19:27:25 -07:00
Eric Traut
39d76a86e7
Fixed a recent regression that results in a false positive when the fully-qualified form of typing.Request is used in an annotation expression. This addresses #8375. (#8381) 2024-07-11 17:36:23 -07:00
Eric Traut
472d86519d Improved consistency of parse node interface definitions. No functional change. 2024-07-11 16:56:22 -07:00
Rich Chiodo
d06b5999ca
Current working directory can't override OS so not necessary to remove it (#8364) 2024-07-10 10:49:42 -07:00
Eric Traut
109a9d03f8
Fixed bug in type narrowing logic for sequence pattern matching when a "star" entry in the pattern captures a TypeVarTuple. The resulting type should be Unknown rather than the unpacked TypeVarTuple. (#8365)
Fixed bug that results in a false positive when assigning type `tuple[Any, ...]` to `tuple[*TS]`. This should be allowed because `tuple[Any, ...]` is a gradual form that is assignable to all tuple types.

This addresses #8357.
2024-07-10 10:24:01 -07:00
Eric Traut
dded9fb056
Added support for negative type narrowing (in the fall-through case) for a mapping pattern consisting of a single dictionary expand entry. This should match all mapping types, eliminating them in the fall-through case. This addresses #8356. (#8363) 2024-07-10 09:27:47 -07:00
Eric Traut
4c4767ef81
Fixed bug that can result in incorrect evaluation of a traditional (pre-PEP 695) type alias the defines a union which is later used as the second argument to an isinstance or issubclass call. This addresses #8358. (#8362) 2024-07-10 08:19:14 -07:00
Eric Traut
8f82d8d3f6 Published 1.1.371 2024-07-09 15:29:04 -07:00
Rich Chiodo
d1b4d65616
Make python interpreter execution more secure (#8341)
* Make python interpreter execution more secure

* Fix test failure
2024-07-09 09:51:07 -07:00
Eric Traut
84b00a627d Updated lock file. 2024-07-08 23:02:54 -07:00
Eric Traut
9c16cc3e49 Bumped min engine version from 1.86 to 1.89 to match the recently-updated language client library requirements. This addresses #8344. 2024-07-08 23:01:35 -07:00
Eric Traut
1925023629 Fixed bug that causes a false positive error when an __init_subclass__ has overloads. This addresses #8343. 2024-07-08 22:59:40 -07:00
Eric Traut
f6dd5c5bef Updated typeshed stubs to the latest version. 2024-07-08 19:36:37 -07:00
Eric Traut
d785aac750
Fixed type evaluation of old-style (pre-PEP 695) type alias that aliases a generic class when it is used as a direct constructor call. This addresses #8337. (#8338) 2024-07-08 13:56:38 -07:00
Eric Traut
fd6081f12d
Did some general code cleanup in type evaluator including shortening names of some variables and functions for readability. (#8330) 2024-07-07 16:08:22 -07:00
Eric Traut
ab6fe409a6 Code cleanup for selfSpecializeClass. 2024-07-07 12:29:52 -07:00
Eric Traut
5332daa9cb Small code cleanup in validateCallForFunction. 2024-07-07 11:59:28 -07:00
Eric Traut
04490f2645 Reformatted test samples using ruff. 2024-07-07 10:34:25 -07:00
Eric Traut
7d410cfbee
Improved handling of tuple expressions used in type expressions that involve specialization, such as dict[()]. (#8329) 2024-07-07 10:06:08 -07:00
Eric Traut
f8bbf78ca5
Added code to TypeVar transform to update the boundToType and strippedFirstParamType. (#8328) 2024-07-07 09:55:03 -07:00
Eric Traut
4c001a139c
Improved type narrowing in the fall-through case for sequence patterns when the pattern includes a star pattern and the subject type is a tuple with an indeterminate entry. (#8323) 2024-07-06 14:44:46 -07:00
Eric Traut
228bd84c54 Fixed bug that results in false negative when a list or set expression includes more than 64 elements and is being evaluated with a bidirectional inference context. This addresses #8314. 2024-07-06 11:51:09 -07:00
Eric Traut
1c85d650ae
Fixed bug that results in a false positive error when using a TypeVar with an upper bound of type as a base class in a class statement. This addresses #8313. (#8321) 2024-07-06 11:47:37 -07:00
Eric Traut
3ddf0ad705
Improved detection of the use of variables used in type annotations. These are illegal according to the typing spec. (#8318)
This addresses #8316.
2024-07-06 10:18:21 -07:00
Eric Traut
598119b90f Fixed bug that results in a false positive error when an unpack operator is used in an unparenthesized tuple expression on the RHS of an augmented assignment operator on Python 3.9 and newer. This addresses #8310. 2024-07-05 09:27:25 -07:00
Eric Traut
8a23d8f596 Fixed bug that results in --outputjson command-line option being incompatible with --threads command-line option. 2024-07-05 09:10:49 -07:00
Eric Traut
057b351efa
Added support for multithreaded type checking in CLI. (#8309) 2024-07-04 20:52:37 -07:00
Eric Traut
746749272c Exposed maxSourceFileSize from sourceFile module. 2024-07-04 17:54:51 -07:00
Eric Traut
4fd12df54a Added functions for converting diagnostics to/from a form that is compatible with JSON serialization. 2024-07-04 17:54:15 -07:00
Eric Traut
4df7ba72a0 Revert "Improved the internal name given to a class that is created through the explicit instantiation of a metaclass."
This reverts commit 8792e4e493.
2024-07-03 14:48:48 -07:00
Eric Traut
8792e4e493 Improved the internal name given to a class that is created through the explicit instantiation of a metaclass. 2024-07-03 14:47:04 -07:00
Eric Traut
8ed6c10486
Changed the hard-coded type of the __class__ symbol to be Self@T rather than T (where T is the enclosing class). This addresses #8305. (#8307) 2024-07-03 14:45:58 -07:00
Eric Traut
d7c5d0691a
Fixed regression that results in a false positive when a traditional type alias (not using PEP 695 syntax) defines a union and is then used as a second argument to an isinstance or issubclass call. This addresses #8302. (#8303) 2024-07-03 12:27:02 -07:00
Eric Traut
93ac52f0b2 Published 1.1.370 2024-07-02 16:45:35 -07:00
Eric Traut
0591abaae8 Fixed bug that results in a false positive reportUntypedFunctionDecorator error under certain circumstances. This addresses #8298. 2024-07-02 16:40:34 -07:00
Eric Traut
8a766d59a4
Fixed bug that results in a false negative when passing an extra keyword argument to a callable that is parameterized with a ParamSpec. This addresses #8294. (#8299) 2024-07-02 16:35:08 -07:00
Eric Traut
280ed52e8c Shortened names of EvalFlags to improve readability. No functional change. 2024-07-02 13:38:58 -07:00
Eric Traut
33a72e3d6a
Improved handling of special forms, including TypeAliasType instances, when used in value expressions. This addresses #8185. (#8296) 2024-07-02 13:30:36 -07:00
Eric Traut
f6c9ca9feb Renamed evaluation flag for clarify and consistency. No functional change. 2024-07-02 08:47:10 -07:00
Eric Traut
2947be68bf Did more code cleanup in the assignment statement evaluation code path. 2024-07-01 20:50:20 -07:00
Eric Traut
3da465b321 Reduced duplicated code in type alias code paths. No functional change. 2024-07-01 20:28:01 -07:00
Eric Traut
139d095cd6
Implemented small optimization in the protocol matching cache. (#8288) 2024-07-01 10:47:36 -07:00