Eric Traut
55b0f35b2c
Improved error handling for the Generic
special form. Eliminated false positive error when Generic
is used in certain legitimate ways within a function.
2021-10-30 13:35:48 -07:00
Eric Traut
4685207d28
Changed type evaluator to elide NoReturn
from union generated from or
or and
operator.
2021-10-30 11:51:20 -07:00
Elijah K
c70cee87ea
Update configuration.md ( #2519 )
...
Links the description of the `executionEnvironment` option. Would have partially prevented a question in #2518 .
2021-10-30 11:09:25 -07:00
Eric Traut
5ea620ad20
Fixed false positive error when a class used within as a TypeVar bound
argument is a "pseudo generic" class, one whose constructor is unannotated.
2021-10-30 09:35:06 -07:00
Eric Traut
174761859f
Published 1.1.183
2021-10-29 21:25:46 -07:00
Eric Traut
cc7216e66e
Changed text representation of inferred type of self
and cls
parameters to Self@ClassName
. This is more consistent with the emerging standard for an explicit Self
type.
2021-10-29 21:21:32 -07:00
Eric Traut
fbd8cfe991
Reworked the logic in canAssignFunction for simplification and correctness. Renamed test files to separate call tests from function tests. Fixed bug that resulted in false positive error when assigning a function that includes a position-only divider to a callback protocol that also contains a position-only divider.
2021-10-29 21:11:14 -07:00
Eric Traut
c701eda4e4
Fixed a bug that allowed a function to be assigned to a (non-protocol) class if that class defined a __call__
method. This should be allowed only for protocol classes.
...
Fixed a bug that allowed a function to be assigned to a protocol class if it defined a `__call__` method but also defined additional methods or attributes.
2021-10-29 16:17:43 -07:00
Eric Traut
31408001e3
Changed type evaluator to elide NoReturn
from union generated from ternary operator.
2021-10-29 10:37:46 -07:00
Eric Traut
733f734e16
Fixed bug that caused the type of super().__new__(cls)
to be evaluated incorrectly.
2021-10-28 18:17:52 -07:00
Eric Traut
e5197f63dc
Fixed bug that resulted in incorrect type evaluation for a generic function that returns a specialized class that uses a Concatenate
in one of the type arguments.
2021-10-28 16:18:19 -07:00
Eric Traut
f4a8527097
Expanded support for bidirectional type checking for function call expressions where the return type of the function includes a TypeVar that also appears within a function parameter and that parameter is a callable.
2021-10-28 00:02:45 -07:00
Eric Traut
bc338c643c
Extended support for bidirectional type inference for functions that have a generic return type and the "expected type" is a generic class with type arguments that include literal types.
2021-10-27 23:41:32 -07:00
Eric Traut
6d3d1279ab
Fixed a recent regression that resulted in a false positive error when Union
was used with no type arguments outside of a type annotation.
2021-10-27 21:51:12 -07:00
Jake Bailey
2f54535227
Fix --skipunannotated flag ( #2504 )
2021-10-27 18:00:35 -07:00
Eric Traut
2cf9c05908
Added special-case handling for type
to accommodate an upcoming change to typeshed's builtins.pyi
.
2021-10-26 22:07:36 -07:00
Eric Traut
5eb6f64e9b
Published 1.1.182
2021-10-26 21:02:30 -07:00
Eric Traut
9b7b5ce675
Reverted typeshed changes to PyYAML because they are not backward compatible.
2021-10-26 21:01:08 -07:00
Eric Traut
88ab721900
Fixed false positive error when a constrained TypeVar T and Type[T] were both used in the same function signature.
2021-10-26 20:22:25 -07:00
Eric Traut
3f79a42409
Revert "Added logic in completion provider to avoid duplicate suggestions in from a import b
statements."
...
This reverts commit 8d2365e101
.
2021-10-26 16:48:12 -07:00
Eric Traut
5367713288
Updated typeshed stubs to latest
2021-10-25 20:54:57 -07:00
Eric Traut
7b42d3cd29
Fixed bug in "--ignoreexternal" option used with package type verification. It was not correctly ignoring all externally-imported symbols that had unknown or partially-unknown types.
2021-10-25 11:29:59 -07:00
Eric Traut
8d2365e101
Added logic in completion provider to avoid duplicate suggestions in from a import b
statements.
2021-10-25 08:22:08 -07:00
Eric Traut
a929741030
Avoid flagging Union[None]
as illegal since it is used to define NoReturn
in typeshed.
2021-10-25 07:49:49 -07:00
Eric Traut
4d4177b0c0
Added check for Union
when only one type argument is provided and it is not an unpacked variadic type variable.
2021-10-25 00:03:24 -07:00
Eric Traut
cb656a2804
Improved handling of intersection types produced as part of isinstance
or issubclass
type narrowing when the source variable is a type variable. The creation of the intersection type was incorrectly eliminating the association with the type variable, so the narrowed type was no longer seen as compatible with the TypeVar.
2021-10-24 23:38:36 -07:00
Eric Traut
102acb795b
Fixed bug that resulted in a false positive when a function returned a callable type that included a parameter with a union type that included an unsolved type variable.
2021-10-24 22:47:31 -07:00
Eric Traut
04d387d7a5
Fixed style issue
2021-10-24 21:33:54 -07:00
Eric Traut
5f3b8935cd
Added missing check for an attempt to write to a named tuple attribute, which generates a runtime exception.
2021-10-24 21:25:36 -07:00
Eric Traut
cf5ddac888
Implemented missing check for a write to a Final instance or class variable outside of the class implementation.
2021-10-24 21:04:53 -07:00
Eric Traut
95a499c478
Published 1.1.181
2021-10-22 23:22:22 -07:00
Eric Traut
ef773d2407
Added "--skipunannotated" option for command-line version of pyright. If specified, pyright skips type analysis of functions and methods that have no parameter or return type annotations. Return types of functions are also never inferred from the function implementation. This matches the default behavior of mypy and allows for more efficient analysis of complex code bases that are only partially annotated.
2021-10-22 23:17:29 -07:00
Eric Traut
94a700b562
Improved analyzer performance for code that contains thousands of statements with tens of thousands of call statements within a single function or module. This is found in some test modules within the sympy library.
2021-10-22 22:14:23 -07:00
Eric Traut
3943afc752
Reduced the max number of nested call-site return type inference evaluations from 3 to 2. This can be extremely expensive in some code bases, such as with scipy, and it was leading to a poor user experience.
2021-10-22 20:53:09 -07:00
Eric Traut
b3e40c4d13
Fixed bug that resulted in an incorrect type evaluation for a binary operator that acts upon a bound TypeVar.
2021-10-22 00:35:12 -07:00
Eric Traut
e23ca55f43
Improved type narrowing logic for class pattern matching when the matched class's type arguments can be determined from the type arguments of the subject type.
2021-10-21 20:16:08 -07:00
Eric Traut
09535d602c
Improved logic for isinstance and issubclass type narrowing when the filter class's type arguments can be determined from the type arguments of the subject type.
2021-10-21 20:16:08 -07:00
Jake Bailey
e039b02ded
Increase max file size to 50 MB, matching VS Code ( #2471 )
2021-10-21 16:25:31 -07:00
Jake Bailey
030ddde1ef
Restore CLI file watcher to pre-refactor state ( #2470 )
2021-10-21 14:28:29 -07:00
Eric Traut
8b222538b9
Fixed bug that caused false positive error when assigning one callback protocol to another when both protocols are generic and parameterized with a ParamSpec.
2021-10-20 23:44:42 -07:00
Eric Traut
8b3f6bbf62
Fixed bug in type printing logic where it incorrectly displayed captured ParamSpec signature with "/" or "*" parameters.
2021-10-20 23:43:14 -07:00
Eric Traut
403b9f0414
Updated typeshed stubs to the latest.
2021-10-20 20:19:52 -07:00
Bill Schnurr
1d97208c65
pull pylance ( #2466 )
2021-10-20 14:42:22 -07:00
Eric Traut
b3244bb446
Published 1.1.180
2021-10-19 22:50:38 -07:00
Eric Traut
09c3c68f16
Fixed bug in check for generator return type. A diagnostic was meant to be generated if the declared return type was incorrect for a generator.
2021-10-19 20:09:11 -07:00
Eric Traut
ddd7ba73c6
Added support for explicit specialization of generic classes that include a ParamSpec. This is defined in PEP 612 but was previously missing.
2021-10-19 19:45:09 -07:00
Eric Traut
1b2aa17227
Changed the printed type of a ParamSpec signature to avoid the use of synthesized parameter names "__p0", etc. Instead, the parameter names are omitted in the signature consistent with the emerging standard for the improved callable syntax.
2021-10-19 19:44:12 -07:00
Eric Traut
960d8b8bbb
Added error reporting for usage of type aliases within class pattern matching statements that generate runtime exceptions.
2021-10-19 08:54:38 -07:00
Eric Traut
c7793f1c6f
Added support for type narrowing of enums when using pattern matching.
2021-10-18 23:14:05 -07:00
Eric Traut
68591ca566
Added support for sequence pattern match type narrowing when the subject type is a simple "object".
2021-10-18 22:02:01 -07:00