Commit Graph

5235 Commits

Author SHA1 Message Date
Eric Traut
327ed377ba Fixed regression in isinstance type narrowing when the filter type is a type[x] rather than x. 2022-06-29 11:27:22 -07:00
Eric Traut
b2b49e26fb Moved some common code for isinstance type guard filtering to eliminate duplication and a source of potential bugs. No functional change. 2022-06-29 10:33:27 -07:00
Eric Traut
d7a5632a2c Added unit test for the previous check-in. 2022-06-29 09:19:42 -07:00
Eric Traut
2e66fc7438 Reverted recent change that resulted in false positive errors when using _ as a placeholder name for methods that are used with @register and similar decorators. 2022-06-29 09:15:49 -07:00
Eric Traut
66c44cff55 Published 1.1.256 2022-06-27 23:42:21 -07:00
Eric Traut
a358ac23a1 Fixed bug that resulted in a false positive error when handling a generic TypedDict with a literal type argument. 2022-06-27 11:31:59 -07:00
Eric Traut
6ed0571adf Fixed a bug in the handling of dataclass where an existing __eq__ method was being overwritten by a synthesized variant. The same was true for other comparison operators. 2022-06-27 08:27:26 -07:00
Eric Traut
9bad0897c6 Fixed a few inconsistent behaviors with incompatible redeclaration reporting. In particular, it's now OK to reassign a function if the assigned value is a compatible function. Also tightened up the special-casing for the symbol _, which is allowed to be redeclared only in the case where both declarations are functions (def statements). This exemption is provided for the single dispatch use case. 2022-06-27 00:53:01 -07:00
Eric Traut
ce9d689e15 Fixed a bug that resulted in a false positive when applying issubclass type narrowing from a type to an abstract class. 2022-06-24 00:20:25 -07:00
Eric Traut
72b063fa55 Fixed case sensitivity problem with test from previous commit. 2022-06-23 09:40:33 -07:00
Eric Traut
c1cb71370d Fixed bug in isinstance type guard logic that resulted in incorrect narrowing when using a dynamic type or types for the second argument. 2022-06-23 09:27:24 -07:00
Eric Traut
04945a4309 Made tweak to documentation for clarity. 2022-06-23 08:34:18 -07:00
PylanceBot
212d146574
[PylanceBot] Pull Pylance with Pyright 1.1.255 (#3606)
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
2022-06-22 13:56:46 -07:00
Eric Traut
1d0abc2411 Moved annotationNotSupported diagnostics under the reportGeneralTypeIssues diagnostic rule so they can be disabled. 2022-06-21 21:22:22 -07:00
Keming
de86a34dd4
fix typo (#3601) 2022-06-21 19:08:37 -07:00
Eric Traut
50d56824c0 Fixed false positive that occurs when overriding an abstract method (e.g. a property) with a field from a named tuple when both are used as base classes. 2022-06-21 13:27:59 -07:00
Eric Traut
44b813c761 Simplified method for determining which abstract methods are not overridden by reversing MRO traversal. No functional change. 2022-06-21 13:27:01 -07:00
Eric Traut
9ad93f8345 Added method ClassType.getReverseMro as a way to clean up a common usage pattern. No functional change. 2022-06-21 13:24:13 -07:00
Eric Traut
11f1a6e48f Improved error message generated when comparing two functions that return TypeGuard return types with incompatible types. 2022-06-21 09:44:46 -07:00
Eric Traut
a08f716f98 Published 1.1.255 2022-06-20 01:12:51 -07:00
Eric Traut
1126711a5d Fixed a bug that resulted in a false negative when assigning a union of tuple[Any] | tuple[int] to an incompatible type. 2022-06-20 00:57:13 -07:00
Eric Traut
8ffea77bf0 Updated typeshed stubs to the latest version. 2022-06-19 23:53:23 -07:00
Eric Traut
8a433a75e0 Changed heuristics in TypeVar constraint solver to handle a TypeVar bound to LiteralString and allow literal types to be retained when solving for this TypeVar. 2022-06-19 20:05:13 -07:00
Eric Traut
de43c9d6c6 Switched from a Map to a Set internally since the former was unneeded. No functional change. 2022-06-19 00:38:08 -07:00
Eric Traut
213223d0cf Added support for overloaded functions that return a TypeGuard or StrictTypeGuard for some overloads. 2022-06-19 00:32:21 -07:00
Eric Traut
b688bebc61 Fixed a bug that resulted in a false negative when performing protocol matching for a class instance when invariance is enforced. 2022-06-19 00:08:42 -07:00
Eric Traut
4ae8b9233e Made suggested improvements to documentation. 2022-06-18 23:00:11 -07:00
Erik De Bonte
35449571db
Auto-import should include import aliases from libraries (#3584) 2022-06-17 22:38:27 -07:00
Eric Traut
0f6ea804f6 Fixed bug that resulted in missing docstrings on an overloaded method when accessed through a member access expression. 2022-06-17 08:23:53 -07:00
Eric Traut
e94de4dec5 Added code to log line and character offset when logging trace details. 2022-06-16 20:34:14 -07:00
Eric Traut
0962e64128 Exempted class members named _ from the "reportIncompatibleMethodOverride" diagnostic check. 2022-06-16 19:42:36 -07:00
Eric Traut
1abe5a422c Fixed bug that results in a false positive error when evaluating type compatibility of a callable with a *args: Any and **kwargs: Any parameter with a callable that contains a ParamSpec. 2022-06-16 16:22:39 -07:00
Bill Schnurr
979d9c9e24
remove preivous connection wrapper for browser, now we dedup packages instead (#3579) 2022-06-15 14:18:18 -07:00
Eric Traut
adf7c3e92e Added constant for Python 3.12. 2022-06-13 00:50:32 -07:00
Eric Traut
055dc1296a Updated comments documentation to talk about reportTypeCommentUsage diagnostic check. 2022-06-12 11:50:47 -07:00
Eric Traut
4e22927305 Published 1.1.254 2022-06-11 20:55:23 -07:00
Eric Traut
d3368781ec Fixed bug in tokenizer that results in incorrect tokenization when a hex numeric literal is followed by a newline followed by either a 'b' or 'o' character. 2022-06-11 15:29:15 -07:00
Eric Traut
ad17c2c376
Changed the handling of partial stub packages to conform with PEP 561. They should always overlay the original package even if that package is marked "py.typed". (#3568)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2022-06-11 15:15:22 -07:00
Eric Traut
90b5de275a Small code improvement in code flow engine. No functional change. 2022-06-11 10:53:40 -07:00
Eric Traut
20f27a8796 Implemented a better solution to handle circular dependencies between classes and their base classes and metaclasses. 2022-06-10 22:16:12 -07:00
Eric Traut
df23be59b9 Undid previous fix related to circular class dependency detection because it introduced a regression with sqlalchemy stubs. 2022-06-10 17:27:49 -07:00
Eric Traut
6c9bc4a63d Added code to print the pyright version as part of the CLI output. This is useful for diagnosis. 2022-06-10 17:26:56 -07:00
Eric Traut
d7dfcd504c Fixed a bug that resulted in a false negative when a variable with a declared type is overwritten by an incompatible type by an import statement. 2022-06-10 17:01:46 -07:00
Eric Traut
484faf7ba3 Added support for new reportTypeCommentUsage diagnostic check. It flag the usage of # type: xxx comments for functions and variables. These are still supported for backward compatibility, but they are increasingly irrelevant and will likely be deprecated in the next few years. 2022-06-09 21:00:47 -07:00
Eric Traut
c5153a557c Minor code cleanup — improved comments, etc. 2022-06-09 17:49:28 -07:00
Eric Traut
376bf81935 Added code to invalidate virtual file system cache when resetting the language server. 2022-06-09 17:48:43 -07:00
Eric Traut
88abe7ae96 Removed obsolete options from launch.json file. 2022-06-09 17:48:02 -07:00
Eric Traut
44c7bf87c5 Fixed bug that resulted in a false negative when attempting to call pop on a TypedDict with a key that is required. 2022-06-09 15:56:48 -07:00
Eric Traut
794d151050 Added new configuration setting called "defineConstant". It allows a configuration to specify one or more identifiers that should be assigned by pyright's binder to be constant anywhere they appear. Values can be boolean (true or false) or a string. If an identifier of this value is used within a conditional statement (like if not DEBUG:) it will affect pyright's reachability analysis for the guarded code blocks. 2022-06-08 22:01:33 -07:00
Eric Traut
9b407f6c9e Added code to detect and flag usage of # type: xxx comments for for and with statements. 2022-06-08 20:34:04 -07:00