Commit Graph

4996 Commits

Author SHA1 Message Date
microsoft-github-policy-service[bot]
2dc6bcae00
Microsoft mandatory file 2022-05-18 22:05:00 +00:00
PylanceBot
0577bc22b9
pull-pylance-with-pyright-1.1.247 (#3474)
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>
2022-05-18 10:08:15 -07:00
Eric Traut
e3b6e7b51c Improved special-case code for functools.totalordering so it enforces the operand type in the provided __lt__ method. 2022-05-18 09:12:20 -07:00
Eric Traut
a83fef3c6f Fixed a bug that resulted in a false positive when using *args or **kwargs within a class argument list. 2022-05-16 20:30:42 -07:00
Eric Traut
7a2faff02a Fixed bug that resulted in a false positive error when an await keyword was used with an operand that evaluated to a bound type variable. 2022-05-16 08:28:20 -07:00
Eric Traut
eb0d7b679b Added more complete validation of types used within a PEP 604-style union. Previously, the use of a P.args or P.kwargs type was not flagged as an error as it should be. 2022-05-15 08:26:25 -07:00
Eric Traut
f4383ab61a Published 1.1.247 2022-05-14 12:32:26 -07:00
Eric Traut
b476192c49 Fixed a bug that resulted in a false negative when doing protocol matching with a generic class that calls its own constructor. 2022-05-14 11:51:35 -07:00
Eric Traut
24e58a6019 Adjusted heuristics for TypeVar constraint solver to better handle the case where a union is assigned to a union of TypeVars and the number of subtypes in these two unions is the same. 2022-05-14 10:58:31 -07:00
Eric Traut
458709e294 Updated typeshed stubs to the latest version. 2022-05-13 22:02:06 -07:00
Eric Traut
509b45731c Improved handling of context managers that swallow exceptions. The type of the context manager is now evaluated using the full type analyzer. The previous technique used some special-case handling which covered about 95% of the cases but left some cases unhandled. 2022-05-13 21:42:27 -07:00
Eric Traut
063a205133 Added code to detect execution flows with long straight-line code flow graph segments. This is not captured in the cyclical code complexity calculations that we normally use to determine if code is too complex to analyze. 2022-05-13 20:40:39 -07:00
Eric Traut
3c6585971e Added small performance and memory optimization in binder that avoids some extra work related to member access expressions. 2022-05-13 20:39:21 -07:00
Eric Traut
214b8de061 Changed the behavior of the type evaluator for generic functions and constructors where a TypeVar is unsolved. Previously, the TypeVar was "leaked". Now it is transformed into an "Unknown" type. 2022-05-12 23:57:43 -07:00
Eric Traut
83ca391198 Fixed a bug that led to a false negative when calling a Callable callback with a generic parameter and passing a non-generic argument. 2022-05-12 22:39:30 -07:00
Eric Traut
a4b53d006c Made internal change to type evaluator for maintainability and correctness. Separate TypeVarContext instances are now passed for the source and destination types. Previously only one was passed and its meaning depended on one the value of the CanAssignFlags.ReverseTypeVarMatching flag, but there are scenarios that require both TypeVarContext instances to be passed. 2022-05-12 22:00:05 -07:00
Eric Traut
8e33b9ceb6 Fixed bug in symbol resolution when a symbol is associated with a class scope but not yet assigned a value. In this case, the runtime looks in the global (module) scope for the symbol rather than following the normal scope hierarchy. 2022-05-12 13:30:31 -07:00
Eric Traut
e0e07d3165 Published 1.1.246 2022-05-10 21:45:24 -07:00
Eric Traut
18d72fcf22 Updated typeshed stubs to the latest. 2022-05-10 21:44:06 -07:00
Eric Traut
977db37df2 Removed redundant check. 2022-05-10 21:31:14 -07:00
Eric Traut
29f1b15cb7 Removed unnecessary conditional check. No functional change. 2022-05-10 20:09:25 -07:00
Eric Traut
f5d931e05e Fixed a bug that resulted in a false positive reportUnknownVariableType diagnostic when using from .A import B statement. The symbol A was flagged as an "unknown" type even though it is not a symbol within the module's symbol table (unless the file is an __init__.py[i]). 2022-05-10 12:41:27 -07:00
Eric Traut
e860737771 Moved more functionality out of typeEvaluator.ts into constraintSolver.ts. No functional change. 2022-05-10 09:04:36 -07:00
Eric Traut
53198149dd Moved constraint solver from typeEvaluator.ts to its own file for maintainability. No functional change. 2022-05-10 08:55:43 -07:00
Eric Traut
07892e0da7 Added check for an attempt to overwrite a method that is marked @final. 2022-05-09 21:31:23 -07:00
Eric Traut
051f74cd68 Removed a bunch of unnecessary if statements and replaced them with ? operator. No functional change. 2022-05-09 21:05:02 -07:00
Eric Traut
8d5da97ba6 More doc improvements. 2022-05-08 11:12:37 -07:00
Eric Traut
9f08b64bcd Added documentation for class and instance variables. 2022-05-08 11:09:48 -07:00
Eric Traut
4c2c6bcc8f Updated "--stats" output in CLI to output both the number of files parsed & bound and the number of files checked. 2022-05-08 10:23:26 -07:00
Eric Traut
48688e94ac Added new verbose output for CLI when combined with '--stats' that outputs the total analysis time of each source file. This will help us narrow down performance problems. 2022-05-08 10:08:57 -07:00
Eric Traut
00dfbca947 Fixed a bug in the logic for synthesizing __init__ methods within a dataclass when a __slots__ definition is present. It was using the order of the slots entries rather than the order of the field declarations. 2022-05-07 17:01:56 -07:00
Eric Traut
cf016129df Fixed a bug in the reportUninitializedInstanceVariable check that results in a false positive error with TypedDict classes. 2022-05-07 16:27:22 -07:00
Eric Traut
ccc95e0545 Published 1.1.245 2022-05-07 01:08:40 -07:00
Eric Traut
b82a4f3266 Finished adding support for generic TypedDict classes. 2022-05-07 00:42:25 -07:00
Eric Traut
5932ef4efd Fixed performance issue that occurred in certain situations involving deeply nested loops and many unannotated variables that are dependent on each other. 2022-05-06 19:22:15 -07:00
Eric Traut
bd467644e5 Fixed a bug in the reportUninitializedInstanceVariable check that results in a false positive when used with a dataclass or dataclass-like class. Seemingly-uninitialized class variables are implicitly overwritten by the synthesized __init__ method in a dataclass. 2022-05-06 10:07:52 -07:00
Eric Traut
5bbb3b5eb8 Modified previous heuristic change so it applies only in cases where the source function has a declared return type with a literal annotation in it. It doesn't apply in cases involving an inferred return type or generic types that are specialized with literals. 2022-05-05 21:09:29 -07:00
Eric Traut
dd7e3b2b82 Changed the heuristics in the TypeVar constraint solver to preserve literals when solving for a TypeVar in a Callable return type. 2022-05-05 21:00:56 -07:00
Eric Traut
648ae44bfe Fixed bug that resulted in false positive error when using a member access expression within a list of base classes in a class declaration statement. 2022-05-05 16:15:49 -07:00
PylanceBot
28c431ef33
pull-pylance-with-pyright-1.1.244 (#3434)
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
2022-05-05 13:44:57 -07:00
Eric Traut
5ed124e090 Fixed a bug that resulted in a stack overflow in rare cases where an unannotated decorator was used on hundreds of functions or methods within the same file. 2022-05-05 10:22:33 -07:00
Eric Traut
b9c187b9e8 Increased the stack trace limit for the CLI version of pyright from the default of 16 to 64 to help with diagnosis of crashes. 2022-05-05 10:20:43 -07:00
PylanceBot
4df1f74ba9
pull-pylance-with-pyright-1.1.244 (#3425)
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>
2022-05-04 10:17:49 -07:00
Eric Traut
80858f61dc Published 1.1.244 2022-05-03 23:51:43 -07:00
Eric Traut
74406b976d Added basic support for generic TypedDict classes, which are supported in Python 3.11. Assignment to a specialized generic TypedDict is now supported, but support for TypeVar solving is not yet in place. 2022-05-03 23:45:00 -07:00
Eric Traut
b8d6e23134 Improved error message for incompatible field types in a TypedDict. 2022-05-03 23:07:11 -07:00
Eric Traut
a9b6311ac5 Fixed bug that resulted in incorrect type evaluation of a dictionary key when assigning a dictionary expression to a dict with a generic key type. 2022-05-03 23:06:07 -07:00
Eric Traut
33d68d3e33 Fixed style issue. 2022-05-03 22:24:55 -07:00
Eric Traut
c1d29bfdb5 Added support for generic NamedTuple classes, which are now supported in Python 3.11. 2022-05-03 22:12:29 -07:00
Eric Traut
c4c27d6474 Fixed bug that resulted in incorrect type analysis for dataclasses when a field declaration was within a conditional block. 2022-05-03 20:48:05 -07:00