Eric Traut
8873b0e6fc
Fixed overflow
2021-11-02 18:41:09 -07:00
Eric Traut
53caa5f1d2
Increased stack trace limit from default to 256 in pyright VS Code extension to facilitate debugging of stack overflow errors.
2021-11-02 17:52:34 -07:00
Eric Traut
371a65387d
Added special-case support for the __self__
attribute of a bound method.
2021-11-02 14:55:29 -07:00
Eric Traut
bcfbf8647d
Fixed a bug in the handling of reveal_type
that caused hover text within the argument to be displayed as Unknown
in some circumstances.
2021-11-02 12:49:09 -07:00
Eric Traut
ddff750944
Improved readability of diagnostic message for type mismatch when assigning to a tuple expression.
2021-11-02 01:19:23 -07:00
Eric Traut
05633a620e
Added support in completion provide for enum members. They are now properly identified as such and prioritized higher in the completion list than other non-member symbols. ( #2520 )
...
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-11-01 14:46:14 -07:00
Eric Traut
bbd3d54f2f
Fixed bug in completion provider where it was not properly handling binding to classes, which left parameter types unspecialized in some cases. It was already properly handling binding to objects (class instances), so this was a straightforward extension.
2021-11-01 13:42:11 -07:00
Eric Traut
8a0f930640
Published 1.1.184
2021-10-31 20:54:57 -07:00
Eric Traut
9f702cf2a9
Fixed bug that resulted in the incorrect type evaluation when a property was defined on a metaclass and accessed through a class with that metaclass.
2021-10-31 20:51:11 -07:00
Eric Traut
0cd946b919
Refactored code flow engine out of type evaluator in an ongoing attempt to reduce the complexity of the type evaluator module.
2021-10-31 20:27:34 -07:00
Eric Traut
1732614749
Added support for trace logging of type evaluation from the command line when both --stats
and --verbose
are specified.
2021-10-31 17:44:19 -07:00
Eric Traut
26446bb174
Added support for "Self" type.
2021-10-31 16:46:23 -07:00
Eric Traut
e2eb60d499
Refactoring and simplification in preparation for Self functionality. No functional change.
2021-10-31 15:48:51 -07:00
Eric Traut
21959463c9
Implemented optimization that reduces analysis time and memory usage by generating a diagnostic message (which often involve converting types to a textual representation) only if the caller is interested in the diagnostic message.
2021-10-31 11:38:39 -07:00
Eric Traut
bab23afdbb
Fixed inconsistency in type printer when emitting inferred type of "self" or "cls" parameter.
2021-10-31 10:36:15 -07:00
Eric Traut
64350daa67
Further improved overload error messages. Use last matching overload if there are multiple matches. This seems to produce better results.
2021-10-30 16:16:02 -07:00
Eric Traut
f692782a0c
Improved error messages for call expressions that involve overloaded functions.
2021-10-30 15:12:48 -07:00
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