Commit Graph

2127 Commits

Author SHA1 Message Date
Eric Traut
90015a3852 Improved bidirectional type inference in the case where the type and the expected type are generic but the expected type is a base class that has been specialized. For example, if the expected type is Mapping[str, int] and the type is a dict. 2020-07-28 14:45:56 -07:00
Eric Traut
14a3851980 Small code cleanup. No functional change. 2020-07-28 14:44:33 -07:00
Eric Traut
d34bc15f7b Fixed bug in logic that handles chained comparisons (e.g. "a < b < c"). The code was not properly handling the case where the left expression was parenthesized (e.g. "(a < b) < c"). 2020-07-28 09:06:38 -07:00
Eric Traut
8b7b5fb1c8 Fixed bug where an f-string expression generated an error if it ended in an equal sign followed by whitespace. The Python 3.8 spec doesn't indicate whether whitespace is allowed here, but clearly the interpreter accepts it. 2020-07-28 08:47:27 -07:00
Eric Traut
ff348b1432 Fixed a bug that caused infinite recursion and a crash when printing the type of a function that refers to itself within its own return type annotation. 2020-07-28 08:32:40 -07:00
Eric Traut
a525ea4ffb Fixed bugs in a few of the "find all references" tests, which were not properly quoting a forward-declared symbol. 2020-07-28 08:32:10 -07:00
Eric Traut
c2c2c51512 Fixed bug that caused "find all references" and "replace symbol" to sometimes miss references to a symbol if they were within quoted type annotations or type comments. 2020-07-28 08:31:29 -07:00
Eric Traut
fdca53a939 Fixed bug that caused duplicate diagnostics to be reported for quoted type annotations in some cases. 2020-07-28 08:28:29 -07:00
Eric Traut
51fd428596 Fixed bug in type checker that resulted in a crash when a function declaration referred to itself within its return type annotation. 2020-07-28 08:25:31 -07:00
Eric Traut
1eac5af6b4 Added strict-mode check for declared return types in type stubs, which don't allow for return type inference. 2020-07-27 21:31:55 -07:00
Eric Traut
63c9b5b691 Fixed a few typos in the inference documentation. 2020-07-27 21:03:20 -07:00
Jake Bailey
77c4908553
Sync from Pylance (#888)
Refactor initialization process to make it overridable.

Rework signature help to use new VS Code / LSP APIs. Function overrides and active parameters are handled much, much better.
2020-07-27 15:34:07 -07:00
Eric Traut
eaa66050a4 Published 1.1.57 2020-07-26 10:48:51 -07:00
Eric Traut
f844bd2f1c Added new diagnostic rule "reportIncompatibleVariableOverride" which is similar to "reportIncompatibleMethodOverride" except that it reports incompatible overrides of variables (non-methods). 2020-07-26 10:32:21 -07:00
Eric Traut
2568f190c5 Augmented the reportIncompatibleMethodOverride diagnostic rule to check for cases where a non-function symbol within a subclass redefines a function symbol in a base class. 2020-07-26 09:46:19 -07:00
Eric Traut
f19c9b2c87 Made the reportIncompatibleMethodOverride rule smarter. It now properly handles position-only parameters and allows a subclass to extend the signature of a method it is overriding as long as the parameters are *varg, **kwarg, or have default values. 2020-07-26 09:14:12 -07:00
Eric Traut
0749db5e26 Fixed bug a homogeneous tuple of indeterminate length was indexed with a constant expression. 2020-07-26 01:42:26 -07:00
Eric Traut
7bc2f3345f Fixed regression in previous check-in. Some stub files rely on decorators being forward-declared. 2020-07-25 20:39:28 -07:00
Eric Traut
e39ecefbe2 Updated type checker's logic for dealing with symbols that are declared in an inner scope and an outer scope but used within the inner scope prior to being redefined. 2020-07-25 20:25:40 -07:00
Eric Traut
540c67f5b9 Fixed the handling of class or instance variable declarations that redefine a same-named symbol in an outer scope but do not use a variable declaration statement within the class. 2020-07-25 19:08:12 -07:00
Eric Traut
cc477872f2 Added support for "NoneType" matching a type expression "Type[T]" during TypeVar matching. 2020-07-25 18:28:02 -07:00
Eric Traut
cff806acb6 Changed logic that converts a type to text so it properly distinguishes between "None" and "NoneType". It previously always output "None". 2020-07-25 18:27:43 -07:00
Eric Traut
cb7632ccfb Changed logic within type evaluator to track differences between None and NoneType. Previously, they were treated interchangeably. This worked in most cases, but there are some edge cases where the difference is important. 2020-07-25 13:55:06 -07:00
Eric Traut
8b47eb9bab Fixed bug that caused partial type stub creation (for subpackages of a top-level package) to be generated in the wrong directory. 2020-07-24 23:06:35 -07:00
Eric Traut
21fb8d1e61 Published 1.1.56 2020-07-24 18:18:46 -07:00
Eric Traut
61436c4961 Fixed bug that generated incorrect type checking error when type alias used a Type[x] type annotation. 2020-07-24 18:17:13 -07:00
Eric Traut
2d3d2cfd76 Fixed bug that caused diagnostics to persist in files that are not part of the workspace even after they are closed. 2020-07-24 18:00:49 -07:00
Eric Traut
20071fd679 Added new version constant for Python 3.10. Updated PEP 612 and 614 features to be dependent on 3.10 rather than 3.9. 2020-07-23 23:12:39 -07:00
Eric Traut
cede09789b Updated typeshed fallback stubs to latest version. 2020-07-23 14:58:35 -07:00
Eric Traut
15c26e9936 Renamed ParameterSpecification to ParamSpec to reflect latest PEP 612 changes. 2020-07-23 14:58:08 -07:00
Eric Traut
33acf3cb88 Fixed bug in dataclass logic that reported spurious error when initializing attribute with field(init=False). 2020-07-23 07:34:58 -07:00
Eric Traut
077139fe66 Fixed bug that caused a spurious error during TypeVar matching when the TypeVar is constrained and is initially matched against an Any or Unknown type but is later matched against a known type. 2020-07-22 23:34:16 -07:00
Eric Traut
e03c86e1df Changed Never internal type to be assignable to any type. Previously, it was assignable to no type. 2020-07-22 23:23:55 -07:00
Eric Traut
a8fc7975d0 Fixed bug whereby a non-function definition (such as an instance variable) within a subclass was not considered as having overridden an abstract method or property within a base class. 2020-07-22 22:40:06 -07:00
Eric Traut
c5cae9c703 Fixed bug in parsing of unicode named character encodings within string literals when the encoding included capital letters. 2020-07-22 22:08:16 -07:00
Eric Traut
dcfcd09a1e Updated CI docs. 2020-07-22 21:54:10 -07:00
Joe Paris
36e4fb3a30
Fixed typo (#876)
Fixed minor typo on line 33.
2020-07-22 17:45:07 -07:00
Eric Traut
2002520d0b Moved CI documentation to its own page. 2020-07-22 16:55:50 -07:00
Eric Traut
d687708503 Updated "getting started" documentation to include an example git hook definition. 2020-07-22 16:53:34 -07:00
Eric Traut
d03b602326 Improved CompletionItemKind for intrinsic class symbols like __name__, etc. 2020-07-22 10:09:37 -07:00
Eric Traut
e57f2927dc Fixed bug that caused quoted type annotation (i.e. a forward reference) that contains type arguments to report an "unbound symbol". 2020-07-21 23:19:26 -07:00
Eric Traut
3f2de3dda9 Added a better fix for the "__name__" issue along with a unit test. 2020-07-21 20:55:09 -07:00
Eric Traut
9074b6cd91 Fixed bug that caused __name__ not to be flagged as an invalid attribute on a class instance. 2020-07-21 20:33:56 -07:00
Eric Traut
9b2430eca7 Delete pre-commit hook file because it doesn't really work as intended. 2020-07-21 20:13:20 -07:00
Eric Traut
20b2a688da Fixed crash in type checker that occurs when removing NoReturn from a union and having no remaining types. 2020-07-21 20:11:00 -07:00
Eric Traut
498c8e2d74 Fixed bug that caused the default python platform not to be specified if there was no config file and no python interpreter selected. 2020-07-21 19:10:49 -07:00
Eric Traut
92c36c85e3 Published 1.1.55 2020-07-21 18:59:39 -07:00
Eric Traut
e6a2b2d77e Fixed recent regression that caused 'isinstance' check to emit a bad error when 'self.__class__' was passed as a second argument. 2020-07-21 18:47:24 -07:00
Eric Traut
88de0a02e3 Fixed bug that resulted in incorrect error when using an unpack operator in an argument expression that corresponds to a *varg parameter in the callee. 2020-07-21 18:30:20 -07:00
Eric Traut
37cf1fa0b4 Update issue templates 2020-07-21 18:05:02 -07:00