Commit Graph

7138 Commits

Author SHA1 Message Date
Lucian Wischik
3f6e47f719
Clarify that "exclude" overrides include directories *and* files (#7216)
The exclude directive overrides include directories *and* include files.

I verified by experiment, and also by reading the source code https://github.com/ljw1004/pyright/blob/main/packages/pyright-internal/src/common/uri/uriUtils.ts#L54
2024-02-06 12:02:57 -08:00
Eric Traut
df9aa7cb01 Published 1.1.350 2024-02-05 08:37:40 -08:00
Eric Traut
ae4bc87530 Improved misleading diagnostic message when attempting to call a special type form. 2024-02-04 16:22:44 -08:00
Eric Traut
626f6553ab
Added missing check for out-of-bound index accesses for named tuple instances. This addresses #7196. (#7207) 2024-02-04 15:26:04 -08:00
Eric Traut
e2fab5397c
Added check for use of TypedDict or NamedTuple as second argument to isinstance call, which isn't allowed. This addresses #7203. (#7206) 2024-02-04 14:53:33 -08:00
Eric Traut
63f7e9e7bb
Added check for an attempt to delete a named tuple entry. This addresses #7197. (#7205) 2024-02-04 13:19:20 -08:00
Eric Traut
9334c9509f Merge branch 'main' of https://github.com/microsoft/pyright into main 2024-02-04 12:46:15 -08:00
Eric Traut
87eb5c2b64 Updated typeshed stubs to the latest version. 2024-02-04 12:45:49 -08:00
Eric Traut
ab6a784f34
Added missing check for an attempt to override a field in a named tuple within a subclass. This addresses #7198. (#7199) 2024-02-03 22:45:49 -08:00
Eric Traut
20c0423748 Added missing check for an attempt to override a field in a named tuple within a subclass. This addresses #7198. 2024-02-03 22:37:44 -08:00
Eric Traut
fe00eaa8a4
Fixed bug in isinstance type narrowing logic that leads to incorrect narrowed type when the filter type (the second argument) and the test type (the first argument) are both type variables. This addresses #7081. (#7194) 2024-02-02 23:23:35 -08:00
Eric Traut
9e2136cb5a Added code to deduplicate references returned by the textDocument/references LSP call. This addresses #7171. 2024-02-02 23:02:28 -08:00
Eric Traut
9716d80fd1
Improved handling of unreachability analysis for an "implied else" (an if/elif chain that is missing a final "else" clause). This addresses #7189. (#7191) 2024-02-02 16:54:17 -08:00
Eric Traut
7c060cb328 Another tweak to improve interruptions. 2024-02-02 12:58:09 -08:00
Eric Traut
e5f13bbad0
Fixed a bug that results in a false positive error when a TypeVar bound to a union of literals is used in the specialization of a TypeAlias whose TypeVar is bound to a wider union of literals. This addresses #7184. (#7187) 2024-02-02 00:56:00 -08:00
Eric Traut
42d853f3d4
Fixed a bug that results in a false negative when a None type is in… (#7176)
* Fixed a bug that results in a false negative when a `None` type is included in an unpacked argument within a function call. This addresses #7175.

* Improved logic for unpacked arguments that contain an "Unbound" type.
2024-01-31 20:50:15 -08:00
Eric Traut
a81633d566
Fixed a bug that resulted in an incorrect type evaluation when a TypeVar with a default (PEP 696) was used in an overload but was not solved. This addresses #7173. (#7174) 2024-01-31 16:59:53 -08:00
Rich Chiodo
e01b0fe205
Add test(s) that validate Pyright can talk over LSP (#7172)
* Everything building, but not running

* More tests passing

* Fix test to open a file

* Remove unused functions and consolidate others

* Remove unused custom lsp messages

* Add comments
2024-01-31 16:38:37 -08:00
Eric Traut
7585378936
Changed behavior of super() method call when self is annotated as a protocol class. This pattern is used for annotating mix-ins. In this case, pyright should not generate an error if the protocol's method isn't implemented. This addresses #7160. (#7168) 2024-01-30 21:04:24 -08:00
Erik De Bonte
8af045b02d
Grant write permissions as needed to workflows that use GITHUB_TOKEN (#7165) 2024-01-30 18:39:58 -08:00
seairth
12e9dd9c9b
Added multi-root workspaceFolder support in path variable expansion (#7138)
Co-authored-by: Seairth Jacobs <sjacobs@wrsystems.com>
2024-01-29 09:48:49 -08:00
Eric Traut
419ae4212f Published 1.1.349 2024-01-28 23:38:14 -08:00
Eric Traut
6457531718
Fixed a bug that resulted in incorrect type narrowing for sequence patterns when the subject expression contains a tuple with an unbounded component. This addresses #7117. (#7156) 2024-01-28 23:31:20 -08:00
Eric Traut
c8c8ceaed4
Fixed a bug that resulted in incorrect type evaluation when calling a tuple constructor with bidirectional type inference and the value passed to the constructor is an Iterable[Any]. This addresses #7085. (#7155) 2024-01-28 21:14:11 -08:00
Eric Traut
7362545f98
Added additional performance enhancements specifically for large unions of literal types. This addresses #7143. (#7154) 2024-01-28 18:07:14 -08:00
Eric Traut
31f09f3189 Added missing check for the use of Annotated or a type alias defined with Annotated as the second argument to an isinstance or issubclass call. This produces an exception at runtime. This addresses #7092. 2024-01-28 13:59:42 -08:00
Eric Traut
509bf6985b Fixed bug that resulted in incorrect type evaluation when a TypeAliasType is used in a value expression. This addresses #7109. 2024-01-28 13:49:04 -08:00
Eric Traut
928d1cf68a
Fixed a bug that results in a false negative when the literal typing.Any is passed to a function that accepts a type[T]. Any is a special form and should not be compatible with type. This addresses #7082. (#7153) 2024-01-28 13:37:41 -08:00
Eric Traut
1d4b1ccb39
Fixed bug in tuple type compatibility logic that resulted in a false negative when dest type includes an upacked unbounded tuple plus additional entries. This addresses #7115. (#7152)
Fixed bug in tuple type compatibility logic that resulted in a false positive when dest type is `tuple[Any, ...]`. This addresses #7129.
Improved error messages for tuple type mismatches that involve tuples with indeterminate types.
2024-01-28 13:02:46 -08:00
Eric Traut
725f91fb9c
Fixed a bug that results in a false positive when using a TypeVarTuple to capture the parameters of a generic callable that includes one or more default argument values. This addresses #7146. (#7150) 2024-01-28 10:43:07 -08:00
Eric Traut
e18963f90e
Added support for enum member aliases defined within an enum class. This addresses #7142. (#7149) 2024-01-28 10:23:40 -08:00
Eric Traut
c7d5fbdb5b
Added special-case logic to handle __name__ and a few other instanc… (#7148)
* Added special-case logic to handle `__name__` and a few other instance variables defined in the `type` class so they are treated specially when accessed from a class instance. This addresses #7145.

* Fixed style issue.
2024-01-28 10:07:56 -08:00
Blake Naccarato
9fb26eb7a3
Clarify virtual environment language in exclude part (#7133) 2024-01-26 09:22:57 -08:00
Eric Traut
ee4e30cf70 Added missing check for inappropriate use of Final in a value expression. This addresses #7094. 2024-01-25 20:04:18 -08:00
Eric Traut
9c0c056b1f
Fixed regression that resulted in a false positive error when calling an abstract method on an abstract class that passes through the constraint solver (e.g. a generic decorator). This addresses #7105. (#7127) 2024-01-25 19:25:46 -08:00
Eric Traut
df5d48c6e3
Fixed a bug that resulted in an incorrect type evaluation for a union type used as a runtime expression. The type should be UnionType, not type[UnionType]. (#7121) 2024-01-25 01:26:05 -08:00
Eric Traut
d94df3abec
Changed handling of tuple with multiple unpacked embedded tuples. Type spec now clarifies this is OK as long as there are not multiple unbounded embedded tuples. This addresses #7114. (#7120) 2024-01-25 00:44:20 -08:00
Eric Traut
dcc33ca58c
Changed the way pyright translates tuple[()] into a specialized Sequence. It used to translate it to Sequence[Any], but the typing spec now clarifies that it should be Sequence[Never]. This addresses #7118. (#7119) 2024-01-24 23:33:09 -08:00
Eric Traut
ebebb7fd3c Removed name consistency match for functional form of Enum. After a discussion in the typing community, it was decided that name consistency checks in some cases were unnecessary and inappropriate for type checkers. 2024-01-24 16:43:03 -08:00
Eric Traut
cfb1de0cc4 Fixed default for reportImplicitStringConcatenation in schema file. 2024-01-22 12:29:32 -08:00
Eric Traut
5aa10443bc Added a few useful links to the docs. 2024-01-21 20:35:11 -08:00
Eric Traut
3ebcef2d90 Fixed minor doc bug. 2024-01-21 20:28:15 -08:00
Eric Traut
015e143247 Removed tests from typeshed stubs. We don't use these, so they're just taking up unnecessary space. 2024-01-21 17:05:31 -08:00
Eric Traut
a168f42a3e Published 1.1.348 2024-01-21 09:50:43 -08:00
Eric Traut
197ecd7bc4
Added three new diagnostic rules: reportArgumentType covers argument type compatibility checks, reportAssignmentType covers type compatibility checks for assignments, and reportReturnType covers type compatibility checks for return and yield statements. This partially addresses #6973. (#7077) 2024-01-21 02:20:52 -08:00
Eric Traut
6ac1a7eebf
Added new diagnostic rule reportCallIssue that covers issues relating to call expressions and arguments. This partially addresses #6973. (#7076) 2024-01-21 01:47:43 -08:00
Eric Traut
63637459ca
Added two new diagnostic rules: reportAttributeAccessIssue is related to attribute accesses and reportIndexIssue is related to index operations and expressions. This partially addresses #6973. (#7075) 2024-01-21 01:35:19 -08:00
Eric Traut
8270551bbe
Added two new diagnostic rules: reportAbstractUsage reports invalid use of abstract classes and methods and reportOperatorIssue covers diagnostics related to unary and binary operators. This partially addresses #6973. (#7074) 2024-01-21 01:07:49 -08:00
Eric Traut
ec6052ea9d
Added two new diagnostic rules: reportInvalidTypeArguments reports invalid type arg usage and reportRedeclaration reports attempts to redeclare the type of a symbol. This partially addresses #6973. (#7073) 2024-01-21 00:33:05 -08:00
Eric Traut
7a67f4fbdb
Added two new diagnostic rules: reportInconsistentOverload reports inconsistencies between overload signatures and/or implementation and reportNoOverloadImplementation reports an overloaded function with a missing implementation. This partially addresses #6973. (#7072) 2024-01-21 00:04:55 -08:00