Commit Graph

4209 Commits

Author SHA1 Message Date
Eric Traut
38dad822cb Fixed bug in handling of __slots__. Entries listed in __slots__ apply only to instance variables, not to class variables. 2021-12-09 15:07:27 -08:00
Eric Traut
fcab8004ba Published 1.1.194 2021-12-08 22:38:35 -08:00
Eric Traut
45b186c5fa Fixed a bug that resulted in a false positive error when a dictionary literal was passed to a constructor of a generic subclass of dict. 2021-12-08 22:36:18 -08:00
Eric Traut
0277d7a108 Added error check for the use of a generic class as a metaclass. 2021-12-08 21:45:31 -08:00
Eric Traut
87bc6630ec PEP 484 indicates that Type[Any] should be interpreted as equivalent to type, but the previous code was treating it as Any. 2021-12-08 21:38:22 -08:00
Eric Traut
282b32a915 Added code to support __qualname__ in class definitions. 2021-12-08 21:07:59 -08:00
Eric Traut
bd588d9729 Fixed a bug whereby an explicit TypeAlias definition that includes a generic type with no explicit type arguments was not assuming Unknown for those type arguments. For example, A: TypeAlias = list should assume that A is equivalent to list[Unknown].
Added a missing diagnostic for an attempt to specialize a class that has already been specialized. This can occur in the case of a type alias, such as `A = list[int], A[int]`.
2021-12-08 20:14:30 -08:00
Bill Schnurr
b81cc63e20
pull pylance: smart indent fixes, dependency update (#2682)
1. Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
  2. Co-authored-by: HeeJae Chang <hechang@microsoft.com>
  3. Co-authored-by: Erik De Bonte <Erik.DeBonte@microsoft.com>
2021-12-08 15:48:25 -08:00
Eric Traut
c938d54efa Fixed bug that resulted in false positive when a variable was modified in a loop that employed conditional type narrowing and was also used as a member access expression. 2021-12-08 12:12:25 -08:00
Eric Traut
9e96b5858d Updated install instructions for command-line to reference community-maintained package. 2021-12-08 09:16:48 -08:00
Eric Traut
c7082e0550 Fixed a bug that caused type narrowing to fail in certain cases when the "X in Y" type guard pattern was used. 2021-12-08 08:41:37 -08:00
Eric Traut
6d33d281a3
Fixed bug that resulted in the import resolution paths retrieved from the currently-selected Python interpreter to omit the working directory if it happens to be in the "sys.path" list. (#2677)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-12-08 00:39:54 -08:00
Eric Traut
e267b8adec Improved handling of x in y type guard to handle the case where y is a tuple. 2021-12-08 00:17:46 -08:00
Eric Traut
c7e4d3badf Fixed bug in specialization of callable type where the return type includes the expansion (unpacking) of a variadic type variable. 2021-12-08 00:10:07 -08:00
Eric Traut
301751c2fb Moved the logic for handling the specialization of generic type aliases into its own function. No functional change. 2021-12-07 23:35:41 -08:00
Eric Traut
d24a31a3a5 Added support for explicit specialization of generic type aliases that include a ParamSpec. 2021-12-07 00:04:21 -08:00
Eric Traut
0739679b0e Fixed inconsistency in definition provider where it would sometimes fail to go to a declaration if the symbol was not re-exported from a type stub or "py.typed" module. 2021-12-06 10:12:32 -08:00
Eric Traut
275956d3d1 Published 1.1.193 2021-12-06 00:22:49 -08:00
Eric Traut
98ea9124f8 Enhanced reportIncompatibleMethodOverride diagnostic check to also detect incompatible methods defined by two classes that are used as base classes in a multiple-inheritance derived class. 2021-12-05 23:28:24 -08:00
Eric Traut
0303cb711f Fixed bug that resulted in false positive when the implementation of a generic class A[T] allocated an instance of itself by calling its own constructor with an argument of type T. 2021-12-05 15:49:58 -08:00
Eric Traut
ae8fda6886 Fixed style issue. 2021-12-05 14:21:05 -08:00
Eric Traut
920095d12d Fixed a bug in the handling of generic classes whose implementation includes another instantiation of itself using the original type parameters as type arguments for the nested instantiation. 2021-12-05 13:16:18 -08:00
Eric Traut
7e038bfeb2 Fixed bug that resulted in TypeVar not being solved in some circumstances involving recursive types. 2021-12-05 12:25:32 -08:00
Eric Traut
8ceedaa3c1 Added optimization in logic that replaces TypeVars with their solved forms. The previous code was generating unnecessary copies of types, which resulted in more memory usage than necessary. 2021-12-05 12:21:11 -08:00
Eric Traut
f1c018b516 Fixed bug in TypeVar solver where Self type was being incorrectly replaced with its concrete form in some cases. 2021-12-05 12:20:12 -08:00
Eric Traut
58aa300287 Renamed isSynthesizedSelfCls field to isSynthesizedSelf for clarity. No functional change. 2021-12-05 12:06:53 -08:00
Eric Traut
1eb9ccd181 Fixed bug that resulted in "unknown" type evaluation for variables assigned in a loop using a tuple assignment pattern. 2021-12-04 10:36:14 -08:00
Eric Traut
47c6a4e329 Updated to the latest typeshed stubs. 2021-12-03 21:17:29 -08:00
Eric Traut
f5ec654bca Fixed incorrect type evaluation for symbols that are modified within a context manager block that is nested within a try/except statement. 2021-12-03 09:53:51 -08:00
Eric Traut
d29c2cb3fb Published 1.1.192 2021-12-02 18:18:45 -08:00
Eric Traut
67a34e1669 Fixed bug in typeshed _csv.pyi file for _Writer.write method that causes false positives because of enforcement of position-only requirements in protocol methods. 2021-12-02 18:15:54 -08:00
Eric Traut
105b7aa5e0 Fixed bug that resulted in false positive parse error when using "/" parameter in type stub when pythonVersion was prior to Python 3.8. 2021-12-02 18:14:27 -08:00
Eric Traut
fdfdc8a74d Fixed regression that resulted in false positive error when using older (pre-3.8) way of specifying position-only parameters. 2021-12-02 18:08:34 -08:00
Eric Traut
61633903f8 Added support for synthesized __hash__ method for dataclass and dataclass_transform. 2021-12-02 17:30:18 -08:00
Eric Traut
1c6b3a2f13 Added missing check in function type compatibility checks for the case where the source type contains position-only parameters but the destination type does not. 2021-12-02 16:50:40 -08:00
Eric Traut
6d7f0798cb Added support for class-based definition of "NewType", which will appear in a new version of typeshed stubs soon. 2021-12-02 10:15:55 -08:00
Eric Traut
acfc919d36 Improved heuristics that are intended to choose the simplest type when more than one solution is possible for a set of type variables. 2021-12-01 19:58:00 -08:00
Eric Traut
3a85b148e3 Fixed regression introduced in previous check-in related to type stubs that use symbol names that overlap with builtins symbols. 2021-12-01 19:30:14 -08:00
Eric Traut
27bf8c1f20 Changed behavior of symbol resolution involving a quoted (forward-declared) type annotation that references a symbol in the global (module) or builtins namespaces. The previous implementation didn't match the runtime behavior of typing.get_type_hints. 2021-12-01 19:12:28 -08:00
Eric Traut
b4b7843c74 Fixed bug that resulted in false positive error when a __new__ method has its own type variables that are not scoped to its corresponding class. 2021-12-01 18:33:52 -08:00
Bill Schnurr
7d03d7cf57
Pull Pylance (#2645) 2021-12-01 16:29:02 -08:00
Eric Traut
7e59a19eaa Updated library guidance doc to clarify point of confusion about import forms. 2021-12-01 08:57:29 -08:00
Eric Traut
5ab4a01d1d Added missing check in package type verifier for generic type aliases with missing type arguments. 2021-11-30 22:43:01 -08:00
Eric Traut
c71001e4ed Improved error message for unknown or partially-unknown type arguments in package type verifier. 2021-11-30 21:22:49 -08:00
Eric Traut
3a9c610826 Fixed a bug in ternary expression type evaluation that resulted in a false positive error. It was not properly handling the case where the condition was statically determined to be false or true. 2021-11-30 21:07:15 -08:00
Eric Traut
e70e69e7a1
Sped up "find reference" by performing a quick text search for the re… (#2641)
* Sped up "find reference" by performing a quick text search for the reference symbol and avoiding additional work for that file if there is no chance of finding a reference within it.

* Avoid parsing the file if its contents don't contain the reference symbol text.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-11-30 20:32:33 -08:00
Eric Traut
ced49848a6 Fixed misleading error message involving a type mismatch within the TypeVar constraint solver. The source and destination types were reversed. 2021-11-30 19:57:29 -08:00
Eric Traut
28d60e62ae Updated command-line documentation for consistency. 2021-11-29 22:31:14 -08:00
Eric Traut
fbb755036e Published 1.1.191 2021-11-29 22:29:55 -08:00
Eric Traut
52c22989ae Changed typeVarTransform logic from a function to a class for future flexibility; no functional change. 2021-11-29 21:28:39 -08:00