Eric Traut
3462044553
Fixed a bug that resulted in false negative errors during protocol matching when a method within the protocol contained a keyword-only parameter annotated with a class-scoped TypeVar.
2022-04-25 12:55:16 -07:00
Eric Traut
8aa2a3d7f4
Implemented small perf improvements to core union functions, which are hot paths in the type analyzer.
2022-04-25 11:28:30 -07:00
Eric Traut
1cdac3e664
Added missing comments for "true", "false" and "undefined" arguments passed to functions.
2022-04-24 09:50:12 -07:00
Eric Traut
adf8b64ec1
Fixed bug that caused a crash when the setter for a descriptor class had only two parameters and was used in a class variable for another class.
2022-04-24 08:51:29 -07:00
Eric Traut
ce91e57369
Fixed a bug that resulted in the incorrect type evaluation for a member expression when the LHS type was a Type[T]
type.
2022-04-23 23:44:34 -07:00
Eric Traut
012ffc5e46
Added limit to the number of recursive function return type inference operations that can be pending concurrently. Theoretically, this could be arbitrarily deep, which will eventually overflow the call stack and crash. Such a crash is showing up in the pylance telemetry. We now limit it to 16 levels deep to prevent this crash.
2022-04-23 21:51:23 -07:00
Eric Traut
5fc4135760
Simplified logic in type evaluator for fetching the bound type of a __call__
method.
2022-04-23 16:40:35 -07:00
Eric Traut
5ca34390d0
Revert "Attempted to work around a crash that appears within the telemetry by not entering any bigint literal values into the map of numeric literals contained within a union."
...
This reverts commit 3ac0a57b6a
.
2022-04-22 09:10:07 -07:00
Eric Traut
d51cea420b
Fixed bug that resulted in combinatoric explosion within a union when using literals in an augmented assignment. This led to crashes in extreme cases.
2022-04-22 09:08:50 -07:00
Eric Traut
69aba8ae90
Added debug flag for logging the code complexity score for functions and modules.
2022-04-21 20:31:10 -07:00
Eric Traut
677fec1de0
Added check for complex code blocks (that contain hundreds of if/elif statements within loops). These now emit an error rather than resulting in tens of seconds of compute.
2022-04-21 19:54:52 -07:00
Eric Traut
90bf0caf20
Enhanced reportIncompatibleMethodOverride check to detect cases where a staticmethod, classmethod or instance method override a method that doesn't match in that regard.
2022-04-21 12:22:29 -07:00
Erik De Bonte
fbc8bcb229
Increase vscode engine to 1.66.0+ ( #3362 )
2022-04-20 14:51:22 -07:00
PylanceBot
90161194e1
pull-pylance-with-pyright-1.1.239 ( #3360 )
...
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <Erik.DeBonte@microsoft.com>
2022-04-20 13:07:38 -07:00
PylanceBot
1874a82f7d
pull-pylance-with-pyright-1.1.239
2022-04-20 19:25:48 +00:00
Eric Traut
fd96bdf363
Published 1.1.239
2022-04-19 22:23:45 -07:00
Eric Traut
aa3b3c599c
Renamed functions internal to the type evaluator for consistency. Previously, we used function names starting with "getTypeOf", "getTypeFor" and "getTypeFrom". I decided to standardize on "getTypeOf".
2022-04-19 22:18:31 -07:00
Eric Traut
d23772888a
Added internal debugging flag for printing "NoReturn" analysis results within code flow engine.
2022-04-19 21:07:39 -07:00
Eric Traut
755fc8f352
Fixed bug in reachability function that could have theoretically produced incorrect type analysis for symbols modified within finally clauses.
2022-04-19 21:07:09 -07:00
Eric Traut
91e435f7e8
Improved code that prints code flow graphs for debugging purposes.
2022-04-19 20:07:36 -07:00
Eric Traut
4233a1e07c
Added utility module (heavily borrowed from TypeScript compiler) that prints a control flow graph for debugging purposes. This is disabled by default but can be enabled with a compile-time switch.
2022-04-19 17:45:08 -07:00
Eric Traut
210f5e755d
Forgot to check in two files with previous commit.
2022-04-19 14:18:13 -07:00
Eric Traut
2fa4f4ed29
Did a small code cleanup of the types that comprise the ExpressionNode
union. Some of the previous types in the union were not really expressions — and were not handled by the getTypeFromExpression call.
2022-04-19 14:15:23 -07:00
Eric Traut
fd98a8a2b9
Updated tree walker code so compiler can provide exhaustive check in switch statement, making it more robust if/when we add new parse node types.
2022-04-18 18:36:54 -07:00
Eric Traut
122daa477c
Added unit test for reported bug in overload implementation check.
2022-04-17 10:51:13 -07:00
Eric Traut
f5d97f3341
Fixed bug that resulted in an infinite loop when a reference to a generic function was passed to itself as an argument.
2022-04-17 10:34:07 -07:00
Eric Traut
98de6eec54
Simplified recursion check in TypeVar transform logic.
2022-04-17 10:08:09 -07:00
Eric Traut
b54a5c8eb3
Renamed TypeVarMap to TypeVarContext for clarity.
2022-04-16 14:49:33 -07:00
Eric Traut
a602258116
Moved getTypeAnnotationForParameter implementation out of type evaluator.
2022-04-16 14:24:26 -07:00
Eric Traut
8fc151b4d5
More refactoring in type evaluator.
2022-04-16 14:18:28 -07:00
Eric Traut
47718a852e
Did some refactoring in type evaluator for readability and maintainability.
2022-04-16 14:04:35 -07:00
Eric Traut
9ead7cafdd
Updated typeshed stubs to the latest.
2022-04-16 09:48:55 -07:00
Eric Traut
55113dbb0b
Simplified internal implementation for creating FunctionType objects.
2022-04-16 08:34:26 -07:00
Eric Traut
e701173051
Published 1.1.238
2022-04-15 22:46:36 -07:00
Eric Traut
c7baf05ca3
Fixed bug that resulted in incorrect type evaluation in cases where a decorator returned a generic Callable[[U], U]
and this decorator was applied to a function with one or more parameters that were typed with a union that included a "raw" type variable, such as func(x: T | list[T])
.
2022-04-15 22:42:04 -07:00
Eric Traut
2c7bcc81e1
Updated library guidance to include a small section on positional-only parameters.
2022-04-15 21:42:42 -07:00
Eric Traut
2633780c6d
Fixed bug in constraint solver logic that resulted in a crash in certain edge cases.
2022-04-15 15:27:05 -07:00
Eric Traut
30848330f0
Fixed a bug that resulted in a false negative when solving for a ParamSpec. The type analyzer wasn't generating an error when multiple assignments to a ParamSpec were incompatible.
2022-04-15 13:44:04 -07:00
Eric Traut
2da104abff
Fixed bug that resulted in a false positive error when assigning certain value types to a property's setter.
2022-04-15 08:58:03 -07:00
Eric Traut
f1e09fed4d
Fixed an infinite recursion crash that occurs within the code flow engine in rare circumstances.
2022-04-14 21:36:47 -07:00
Heejae Chang
3cf9e3f6a5
add i to glob pattern regex for case insensitive file system. ( #3349 )
2022-04-14 19:37:32 -07:00
Robert Craigie
4893d44d08
Add support for showing key on hover for unions of TypedDicts ( #3348 )
2022-04-14 18:24:12 -07:00
Eric Traut
acad70e5cb
Fixed bug in type evaluation of a generic type alias that refers to a generic Callable
and is missing explicit type arguments. The type argument should implicitly be Unknown
in this case.
2022-04-14 16:56:07 -07:00
Eric Traut
3ac0a57b6a
Attempted to work around a crash that appears within the telemetry by not entering any bigint literal values into the map of numeric literals contained within a union.
2022-04-13 19:22:47 -07:00
PylanceBot
af32b7d815
pull-pylance-with-pyright-1.1.237 ( #3339 )
...
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <Erik.DeBonte@microsoft.com>
2022-04-13 13:54:35 -07:00
Eric Traut
5e41a65407
Improved error message for protocol mismatch due to invariance of mutable attributes.
2022-04-13 11:23:54 -07:00
Eric Traut
113c85ba01
Fixed a bug that generated a false positive when importing from a "py.typed" namespace package. This change also loosens the requirements for a "py.typed" file to be in each of the submodules within a namespace package; a single "py.typed" within the top-level namespace directory is also now supported.
2022-04-13 08:56:21 -07:00
Eric Traut
551c6acdcb
Published 1.1.237
2022-04-12 21:32:08 -07:00
Eric Traut
cb9bdd5576
Fixed a bug that resulted in a runtime assertion (and crash) when dealing with return expressions that involve more than one constrained TypeVar.
2022-04-12 15:39:55 -07:00
Eric Traut
6a038843a6
Expanded the reportUnknownVariableType
check to cover some cases that it didn't previously. It now handles unknown or partially-unknown symbols imported from from a import b
statements, unpacked assignments, with a as b
statements, and more.
2022-04-11 23:28:40 -07:00