Eric Traut
4cd4d6c423
Added type checking support for functools.partial. This advanced support does not work with overloads or argument lists that include list or dictionary unpack operators.
2021-12-22 15:56:56 -07:00
Eric Traut
bd3fc2d84d
Published 1.1.199
2021-12-22 03:05:16 -07:00
Eric Traut
7b3e6e05a1
Fixed bug in type evaluator that masked certain type errors when assigning a concrete type to a class TypeVar type.
...
Fixed bug that caused false positive when passing a generic function callback as an argument to another generic function.
2021-12-22 02:53:41 -07:00
Eric Traut
e11b97c03b
Fixed potential crashing bug.
2021-12-22 01:44:06 -07:00
Eric Traut
84f82f87ad
Fixed bug that resulted in infinite recursion in certain cases when an aliased conditional expression was used.
2021-12-21 16:58:26 -07:00
Eric Traut
f839fd7fa7
Small code cleanup in parseTreeWalker to make the order of case statements the same as the parse tree node enumeration.
2021-12-21 16:56:01 -07:00
Eric Traut
f7dbfc8449
Improved handling of call expressions that have a NoReturn
type. In particular, the logic now handles constructors, __call__
methods, inferred symbol types, and symbol import chains.
2021-12-21 16:16:45 -07:00
Eric Traut
c76693fb99
Fixed a bug that resulted in an incorrect type inference when assigning to a list that includes an unpacked target variable.
2021-12-21 13:32:37 -07:00
Eric Traut
520ac113c8
Added type checking for class constructor calls when the class has a metaclass with a custom __call__
method.
2021-12-21 12:55:58 -07:00
Eric Traut
e3fbc13703
Fixed recent regression that resulted in false positive when assigning a Type[Proto]
to Type[Proto]
.
2021-12-21 12:25:31 -07:00
Eric Traut
613b8d303d
Fixed incorrect and confusing debug assertion string.
2021-12-21 09:57:30 -07:00
Eric Traut
7475c7b3a8
Updated typeshed stubs to the latest version.
2021-12-21 08:38:00 -07:00
Eric Traut
12eb0bf32d
Fixed bug that resulted in false positive error when class constructor is invoked with more than one argument and the class's metaclass has a custom __call__
method.
2021-12-21 08:37:49 -07:00
Eric Traut
48db423c7b
Published 1.1.198
2021-12-20 13:00:28 -07:00
Eric Traut
4316c23778
Improved error message (and reduced cascading errors) for the case where a variable is incorrectly used as the LHS of a subscript expression within a type annotation.
2021-12-20 12:58:50 -07:00
Eric Traut
940321b254
Added logic to handle the case where a declared return type of a function includes a constrained TypeVar and a return statement is guarded by a conditional check that guarantees that the constraint is met on that code path.
2021-12-20 12:26:00 -07:00
Eric Traut
31499df439
Fixed a false negative (missing) error when a method within a generic class was annotated to return a generic type of itself.
2021-12-20 00:01:57 -07:00
Eric Traut
18fd8330b7
Changed the behavior of the new callable syntax to not accept ...
with other parameters. After further discussion on the typing-sig, the consensus is that supporting this will cause confusion.
2021-12-19 10:41:41 -07:00
Eric Traut
be851a8350
Fixed a bug in the handling of the new callable syntax when it's used with an "async" keyword. The resulting return type should be Awaitable
rather than Coroutine
.
2021-12-19 10:30:23 -07:00
Eric Traut
d65850ef92
Fixed bug in handling of callable syntax when a TypeVar, ParamSpec or TypeVarTuple was used outside of an appropriate scope. No error was emitted in this case.
2021-12-19 10:27:18 -07:00
Eric Traut
ebae8c3c0c
Added support for __getattr__
and __getattribute__
overloads that are typed with a literal str representing the attribute name.
2021-12-18 18:59:11 -07:00
Eric Traut
836a1fcf9b
Changed type logic to allow type
to be assigned to Type[T]
. In this case, type
is treated the same as Type[Any]
, so T
receives a value of Any
.
2021-12-18 18:34:48 -07:00
Eric Traut
998a016f69
Added support for assigning a param spec to a ...
signature, since the latter is the Any
equivalent for ParamSpecs.
2021-12-17 21:51:38 -08:00
Eric Traut
a48b0d1347
Added support for class types that satisfy protocols. This is specifically allowed in PEP 544 in the section titled "Type[] and class objects vs protocols".
2021-12-17 21:26:29 -08:00
Eric Traut
b6389b35b3
Added missing check mandated by PEP 544, which disallows an assignment of a class type to a Type[Proto] if the class type is a protocol itself.
2021-12-17 20:27:00 -08:00
Eric Traut
e7ae5a02a1
Fixed style issue
2021-12-17 10:33:55 -08:00
Eric Traut
5bc14bcebe
Fixed bug that resulted in false positive errors when using a TypeVar within the new callable syntax within a function declaration.
2021-12-17 10:25:45 -08:00
Eric Traut
7578f2d362
Added support for exception group syntax introduced in PEP 654.
2021-12-17 10:10:39 -08:00
Eric Traut
c5ac73b37e
Published 1.1.197
2021-12-16 23:18:03 -08:00
Eric Traut
c935199fb3
Added support for draft PEP 677: callable type syntax.
2021-12-16 23:15:54 -08:00
Eric Traut
1ed3aae7ad
Fixed bug that caused crash in type analyzer when a TypeVar of the same name was declared twice in the same scope with constraints in one case and without in the other.
2021-12-16 23:10:44 -08:00
Eric Traut
e89c48da64
Made additional improvements to text representations of types.
2021-12-16 23:08:51 -08:00
Eric Traut
b51d5b1998
Fixed another error in pyrightconfig JSON schema, which duplicated a couple of IDs.
2021-12-16 23:05:25 -08:00
Eric Traut
1ef2bbbb02
Fixed error in pyrightconfig JSON schema, which duplicated a couple of IDs.
2021-12-16 21:34:17 -08:00
Eric Traut
8862557894
Changed text representation of callables to more closely match the syntax introduced in PEP 677 including the use of "..." to represent "any parameters" and "**P" to represent a ParamSpec.
2021-12-16 21:33:39 -08:00
Eric Traut
4a9ba57532
Fixed bug that resulted in a false positive error when Required
or NotRequired
special forms were used with no type arguments in contexts where they are used as runtime class names rather than type annotations.
2021-12-16 16:36:42 -08:00
Eric Traut
f2e83a6a84
Fixed several bugs where Type[None]
was incorrectly treated as compatible with None
and vice versa.
2021-12-16 15:28:10 -08:00
Eric Traut
476411c97c
Fixed bug that caused false positives when assigning a function to a generic class or callback protocol that is parameterized with a ParamSpec that is specialized using an ellipsis.
2021-12-16 14:31:01 -08:00
Eric Traut
348e8b2a3d
Added support for ellipsis type argument for a generic alias that uses a ParamSpec.
2021-12-15 20:07:34 -08:00
Eric Traut
60e49580e4
Added name to dummy type created for protocol variance testing.
2021-12-15 19:48:06 -08:00
傅立业(Chris Fu)
57cc03dca0
Protocol type var variance fix ( #2712 )
...
* Add a test for validating protocol type variable variances with unions of multiple type variables
The test is supposed to fail at this point.
* Fix bug that protocol type variables existing in a union type of multiple type varaibles are not treated as covariant with this union type
* Fix typos, replacing "arbitary" with "arbitrary"
2021-12-15 19:45:50 -08:00
Eric Traut
61f9a2d3bb
Fixed style issue.
2021-12-14 23:36:17 -08:00
Eric Traut
f7cc3f0ed0
Fixed bug in type evaluator that resulted in incomplete (Unknown) types when variable types depend on each other within a loop and one of the expressions involves an unpack operator.
2021-12-14 22:58:15 -08:00
Eric Traut
29593d98f8
Improved README text.
2021-12-14 22:52:00 -08:00
Eric Traut
7247ce8f1f
Fixed bug in type narrowing logic for comparisons to literals that involve enums declared in a type stub. It was incorrectly narrowing the type to Never
in the negative (else) case.
2021-12-14 22:37:00 -08:00
Eric Traut
36f770e091
Fixed bug in type narrowing code for literal enums. It wasn't correctly handling the edge case where the enum class has no enumerated members.
2021-12-14 22:11:30 -08:00
Eric Traut
11f8f56a98
Published 1.1.196
2021-12-14 21:38:59 -08:00
Eric Traut
6da2e0ec81
Fixed false positive error with reportUnnecessaryIsInstance diagnostic check with the provided class is dynamic.
2021-12-14 21:35:35 -08:00
Eric Traut
df3313c2cd
Fixed a bug that resulted in incorrect type resolution when evaluating mutually-dependent variables within a loop where one of the expressions involved a call to a constructor with an unpacked argument.
2021-12-14 20:09:16 -08:00
Eric Traut
dbea0c48ed
Fixed a bug that resulted in incorrect type evaluations when a generic class using a ParamSpec was explicitly specialized using a Concatenate
in the type argument, as in A[Concatenate[int, P]]
.
2021-12-14 17:31:12 -08:00