Commit Graph

4282 Commits

Author SHA1 Message Date
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
Eric Traut
bffa63f5a5 Small code simplification, no functional change. 2021-11-29 20:33:17 -08:00
Eric Traut
541ddcb935 Changed parse error messages related to unclosed parentheses, braces and brackets so they are reported at the location of the starting token to better match the new Python 3.10 parse error reporting behavior. 2021-11-29 13:35:24 -08:00
Jos Verlinde
8d32784230
extend documentation on JSON (#2635)
copying the information provided as answer to https://github.com/microsoft/pyright/issues/2634
2021-11-29 13:20:41 -08:00
Eric Traut
cae15781a3 Enhanced truthy/falsy type narrowing pattern to handle classes that contain a __bool__ method that always returns True or False. 2021-11-28 02:52:39 -08:00
Eric Traut
3ff69a1ffc Fixed bug in "--ignoreexternal" mode of "--verifytypes" feature. It was not properly flagging errors when the type was external (and known) but the type arguments were partially unknown. 2021-11-28 01:59:05 -08:00
Eric Traut
04d1bcf9f5 Fixed bug that resulted in a false positive error when using class pattern matching with type variables. 2021-11-28 01:34:05 -08:00
Eric Traut
880efb3ca7 Fixed a hole in the check for partially-unknown types. Generic type aliases that are not specialized or are partially specialized (i.e. only some type arguments are specified) should trigger this check. 2021-11-27 17:41:04 -08:00
Eric Traut
ed84eb7b36 Changed reportPropertyTypeMismatch to be disabled by default in all diagnostic modes. 2021-11-27 17:08:01 -08:00
Eric Traut
96030b2961 Exempted class symbol __weakref__ from type completeness check since its type is well defined by the Python spec. 2021-11-27 16:52:49 -08:00
Eric Traut
f714e092a0 Updated dataclass_transform documentation to reflect Python 3.10 changes. 2021-11-27 15:50:31 -08:00
Eric Traut
4d4dd8858c Added special-casing to suppress "partially unknown type" diagnostic within member access expressions when they are used to access non-specialized generic classes within an argument expression. There are legitimate uses of partially unknown types in this case (e.g. in "isinstance" calls). 2021-11-26 11:36:44 -08:00
Hubert
736e41c63c
Added keyword-only check to dataclasess __match_args__ (#2615)
* Add keyword-only check to dataclasess `__match_args__`

* Fixed tests added in add keyword-only check to dataclasess `__match_args__`
2021-11-25 11:13:26 -08:00
Eric Traut
b269ee9a85 Published 1.1.190 2021-11-24 18:43:33 -08:00
Eric Traut
a3dee52702 Changed logic that determines whether a function should be exempt from return type consistency checks. If a function or method contains only a docstring but no ..., it is no longer exempt (unless it is an @overload). 2021-11-24 17:16:28 -08:00
Eric Traut
7184425c47 Further improved check for inconsistent use of tabs and spaces to catch a previously-unreported case that generates runtime errors. This change handles inconsistent dedents. 2021-11-24 17:02:12 -08:00
Eric Traut
280d95cd80 Updated documentation for reportUnusedVariable. 2021-11-24 16:05:53 -08:00
Eric Traut
ced19cbcbd Changed reportUnusedVariable diagnostic check to exempt variables whose names begin with an underscore. 2021-11-24 16:04:57 -08:00
Eric Traut
3e8101bcd0 Added a type consistency check for TypedDicts which are otherwise compatible except that one is marked @final and the other is not. 2021-11-24 15:36:57 -08:00
Eric Traut
481f02a7cc Improved check for inconsistent use of tabs and spaces to catch a previously-unreported case that generates runtime errors. 2021-11-24 15:32:13 -08:00
Eric Traut
7f4b0b0036 Updated typeshed stubs to the latest. 2021-11-24 10:39:01 -08:00
Eric Traut
cd3892c059 Fixed bug that resulted in unreported Unknown type in strict mode when the type was evaluated as part of a call to an overloaded function in some circumstances. 2021-11-24 10:38:40 -08:00
Eric Traut
8dc3b1da12 Fixed style issues. 2021-11-23 20:29:09 -08:00
Eric Traut
4353a33151 Fixed bug that prevented error when a generator function returned an inappropriate type if that type was a subclass of Iterable. 2021-11-23 20:20:19 -08:00
Eric Traut
86a975da16 Added support for async functions that return NoReturn type. 2021-11-23 04:29:54 -08:00
Eric Traut
795a37f624 In the case where a type annotation is an illegal form (e.g. a variable or a function), the annotation should evaluate to an Unknown type. 2021-11-23 03:01:03 -08:00
Eric Traut
100029a3ff Fixed bug that caused false positive when evaluating type compatibility between two TypedDict types that are structurally the same but have different declarations. PEP 589 indicates that these should be treated as compatible types. 2021-11-22 14:10:37 -08:00
Eric Traut
58465482e2 Published 1.1.189 2021-11-21 23:11:49 -08:00