Commit graph

8305 commits

Author SHA1 Message Date
Eric Traut
ae64f08f39 Published 1.1.401 2025-05-20 16:42:25 -07:00
Eric Traut
5021af8f05
Fixed bug in type narrowing logic for class patterns in a match statement. Negative type narrowing was incorrect when the subject is a literal type and the class is the corresponding non-literal class. This addresses #10473. (#10479) 2025-05-20 10:12:04 -07:00
Eric Traut
5a9009d8c4 Fixed a bug that results in incorrect expansion of the bytes promotion type if the value is a bytes literal. This issue was discovered when fixing another bug. 2025-05-20 09:56:51 -07:00
Eric Traut
3b992dc310
Added missing check for unquoted self references when calling TypeAliasType constructor manually (as opposed to using the PEP 695 type syntax). This addresses #10475. (#10478) 2025-05-20 09:38:46 -07:00
Eric Traut
5d79dbbbcd
Switched internal usage of builtins.function, typing.AwaitableGenerator, and typing._TypedDict to types.FunctionType, _typeshed._type_checker_internals.AwaitableGenerator, and _typeshed._type_checker_internals.TypedDictFallback, respectively. This addresses #10437. (#10460) 2025-05-17 17:10:33 -07:00
Eric Traut
84de29e57a
Updated typeshed stubs to the latest version. (#10456) 2025-05-16 21:23:33 -07:00
Eric Traut
6f26801039
Enhanced x is ... type narrowing logic to narrow Any | EllipsisType to EllipsisType to match x is None narrowing logic. This addresses #10443. (#10455) 2025-05-16 21:07:46 -07:00
Eric Traut
6c53dbae29
Fixed a bug that results in a spurious error when __class__() is assigned to Self. This addresses #10451. (#10452) 2025-05-16 13:35:37 -07:00
dependabot[bot]
b3b56a6fa6
Bump undici from 6.21.1 to 6.21.3 in /packages/vscode-pyright (#10445)
Bumps [undici](https://github.com/nodejs/undici) from 6.21.1 to 6.21.3.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.21.1...v6.21.3)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.21.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-15 08:40:24 -07:00
Eric Traut
fbe330f7c9
Fixed bug that results in incorrect type narrowing behavior when the second argument to an isinstance call includes a union (specifically with the | operator) within a tuple expression. This addresses #10426. (#10429) 2025-05-08 18:27:18 -07:00
Eric Traut
f095c31027 Modified --verifytypes output to expand type aliases in its error messages to help diagnose "partially unknown" conditions. 2025-05-05 21:09:45 -07:00
Eric Traut
0ed54e7943 Removed obsolete comment. 2025-05-01 22:12:19 -07:00
Eric Traut
80197396a8
Fixed bug that results in a false negative when deriving from a stdlib protocol class and not implementing one or more abstract methods. This addresses #10401. (#10402) 2025-05-01 21:09:22 -07:00
Bill Schnurr
a0dd8250f0
Pull Pylance with Pyright 1.1.400 (#10398) 2025-04-30 19:17:26 -07:00
Eric Traut
f67576357b
Fixed bug that results in a false positive error under certain circumstances where the second argument for a super call is a union. This addresses #10388. (#10389) 2025-04-28 16:19:04 -07:00
Eric Traut
4f6ca60f72
Fixed bug that results in incorrect variance inference when a property access method uses a method-local type variable to annotate the self parameter. This addresses #10367. (#10387) 2025-04-28 12:42:55 -07:00
Eric Traut
458615b353
Improved handling of __slots__ members to correctly model the case where a descriptor object is stored in a __slots__ variable. This addresses #10370. (#10382) 2025-04-27 12:31:42 -07:00
Eric Traut
c07f62985a
Fixed a bug that leads to a false negative when accessing a key on a TypedDict that is defined with extra_items=Never. This addresses #10377. (#10379) 2025-04-26 12:38:23 -07:00
Eric Traut
907f49f8f5
Fixed a bug in the type narrowing logic for the S in D type guard pattern (where S is a string literal and D is a TypedDict). If the TypedDict is not closed, the absence of the key within the TypedDict definition cannot eliminate the type during narrowing. This addresses #10376. (#10378) 2025-04-26 12:36:08 -07:00
Erik De Bonte
f2adab36d8
Attempt to fix pipeline npm package build by moving it to Linux (#10361) 2025-04-24 19:21:21 +00:00
Bill Schnurr
b962ffc290
pull-pylance-with-pyright-1.1.400-20250423-051641 (#10362)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Rich Chiodo <rchiodo@microsoft.com>
Co-authored-by: Stella Huang <stellahuang@microsoft.com>
Co-authored-by: Kacie Kang <jikang@microsoft.com>
2025-04-23 19:36:25 +00:00
Eric Traut
890401e4cf Published 1.1.400 2025-04-22 20:49:09 -07:00
Erik De Bonte
94c5ebf090
Temporarily disable npm publishing in azure-pipelines-release.yml (#10360) 2025-04-22 11:21:00 -07:00
Eric Traut
aebb127b63
Fixed a bug that results in a false positive error when calling a function with an unpacked TypedDict with extra_items when additional keyword args are passed. This addresses #10352. (#10357) 2025-04-20 23:27:41 -07:00
Eric Traut
7bcff6bfed
Added check for named tuple field names that begin with an underscore. These result in a runtime exception. This addresses #10351. (#10353) 2025-04-19 20:07:03 -07:00
Eric Traut
1d4663540f Fixed a bug that results in missing diagnostic details under certain circumstances where bidirectional type inference is attempted in the assignment of an attribute. This addresses #10345. 2025-04-18 11:34:30 -07:00
Dima Tisnek
08e2aca3c5
docs: fix a typo in type guard descriptions (#10343) 2025-04-17 19:10:10 -07:00
Eric Traut
b2882ee69b
Fixed a bug that leads to a hang when a generic type alias definition refers to itself. This addresses #10287. (#10334) 2025-04-15 23:09:25 -07:00
Eric Traut
1b4d7cd0ce
Fixed bug that results in a spurious "type already specialized" error when using a class-scoped type alias defined using a type statement or TypeAliasType constructor. This addresses #10330. (#10332) 2025-04-15 15:12:22 -07:00
Eric Traut
41b8d83170
Added support for PEP 765, which makes it a syntax error (or warning) in Python 3.14 if a return, break or continue is used to exit a finally clause. This addresses #10319. (#10323) 2025-04-14 16:08:49 -07:00
Eric Traut
e5ecd9e32f
Reverted a recent change that extended the reportPrivateImportUsage check to enforce imports from submodules whose names begin with an underscore. This change was disruptive to users of the popular pandas library because it exports a submodule named _typing. This was originally intended to be experimental or private, but it was never fully addressed. The pandas maintainers will work to fix this issue (https://github.com/pandas-dev/pandas/issues/55231) over the next year. I'm going to back out this change to pyright in the meantime. (#10322) 2025-04-14 13:27:13 -07:00
Eric Traut
cd37049e44
Fixed bug that causes bidirectional type inference not to be used in cases where a ternary expression is assigned to an annotated instance or class variable and the ternary condition narrows the type of self or cls. This addresses #10318. (#10321) 2025-04-14 13:26:44 -07:00
Eric Traut
cb3e2ba297
Fixed bug that results in a false positive error when referencing a class-scoped type alias defined as a callable. This addresses #10282. (#10308) 2025-04-11 23:37:10 -07:00
Eric Traut
4433ad4f50 Added utility function for testing for functions or overloads. This is an internal simplification. No functional change. 2025-04-11 23:10:39 -07:00
Eric Traut
e77fca46e5
Extended "type(x) is C" type narrowing logic to support cases where C is a union of types or a type variable with a union upper bound. This addresses #10288. (#10307) 2025-04-11 14:24:42 -07:00
Eric Traut
a9d7613486
Fixed bug that results in incorrect type narrowing of a variable that is shadowed in an inner-scoped comprehension. This addresses #10301. (#10306) 2025-04-11 11:51:20 -07:00
Eric Traut
6b6a335cfc
Fixed bug that results in a false positive when accessing a generic attribute from an object whose type is type[X]. This addresses #10304. (#10305) 2025-04-11 11:03:28 -07:00
Erik De Bonte
3cb77e7db8
Change owner from plseng to me (#10285) 2025-04-09 19:18:46 +00:00
Bill Schnurr
0d2f6f6321
Pull Pylance with Pyright 1.1.399 (#10286)
Co-authored-by: Bill Schnurr <bschnurr@microsoft.com>
Co-authored-by: HeeJae Chang <hechang@microsoft.com>
Co-authored-by: Erik De Bonte <erikd@microsoft.com>
Co-authored-by: Rich Chiodo <rchiodo@microsoft.com>
Co-authored-by: Stella Huang <stellahuang@microsoft.com>
Co-authored-by: Kacie Kang <jikang@microsoft.com>
2025-04-09 11:53:05 -07:00
Eric Traut
227f70b4d5 Published 1.1.399 2025-04-08 11:34:37 -07:00
Erik De Bonte
0ab612b90b
Automate publishing of pyright package to npmjs.com (#10202) 2025-04-08 11:00:56 -07:00
Eric Traut
6c011f0a62 Fixed documentation bug for reportOptionalOperand check. It does not apply to boolean operators like or, and, and not. Use of None for such operands are legitimate and do not result in runtime errors. 2025-04-07 16:21:16 -07:00
Erik De Bonte
ae0ebce896
Fix "Bind called unnecessarily" assert when __builtins__.pyi imports the file being bound (#10263) 2025-04-07 23:15:55 +00:00
Eric Traut
53cc72beb1 Updated typeshed stubs to the latest version. This version removes support for Python 3.8, which is now out of service. 2025-04-07 16:04:47 -07:00
Eric Traut
ccb22d04ee
Fixed bug that leads to a false positive in the reportUnnecessaryComparison check when one operand's type is a callable and the other is not. This addresses #10253. (#10267) 2025-04-07 15:46:08 -07:00
Eric Traut
8230e85a1b
Extended the check for isinstance and issubclass argument validation to flag the Literal special form, which leads to a runtime error when used in the second argument. This addresses #10258. (#10265) 2025-04-07 15:08:16 -07:00
Eric Traut
74d407a74e
Fixed bug that results in a false negative when a return statement contains a call expression that invokes a NoReturn call and the argument list contains errors. This addresses #10260. (#10264) 2025-04-07 14:51:29 -07:00
Eric Traut
890e6036b0
Fixed bug that results in an incorrect error under certain circumstances when inferring the return type of a recursive function that has a decorator or is async. This addresses #10242. (#10244) 2025-04-07 13:43:47 -07:00
Eric Traut
54f7da25f9
Fixed a bug that results in a false negative when a class that derives from type[Any] is assigned to any other type. This addresses #10185. (#10224) 2025-03-31 00:28:45 -07:00
Eric Traut
c08b0e7cc6
Removed support for ru and ur string prefixes. These were supported in Python 2.7 but are syntax errors in Python 3.x. This addresses #10222. (#10223) 2025-03-30 20:39:03 -07:00