Граф коммитов

7911 Коммитов

Автор SHA1 Сообщение Дата
Eric Traut c58d75c021
Fixed bug that can result in incorrect type evaluation behaviors if a call to `type` is used within a loop. This addresses #9023. (#9024) 2024-09-17 19:05:20 -07:00
Eric Traut a56a4ecfcd Published 1.1.381 2024-09-17 15:52:44 -07:00
Erik De Bonte 06ab7a8899
Update Unicode range tables to match Unicode 16.0 (#9020) 2024-09-17 12:13:14 -07:00
Bill Schnurr ea18695c34
Add new vscode signing (#8977) (#9019)
Add new vscode signing, make sure signature file is different from the source manifest file.
When publishing to marketplace reuse artifacts for VSIX, instead of downloading from github
Include new manifest and signature files when publishing to marketplace
2024-09-17 10:43:59 -07:00
Eric Traut c20e613319
Fixed a bug that results in spurious "variable not allowed in type expression" errors when a type alias is used in a loop in both a type expression and a value expression. This addresses #9017. (#9018) 2024-09-17 10:01:45 -07:00
Rich Chiodo e353c9dec5
Put back logic of recreating the background analysis token on every schedule analysis (#9016)
* Recreate the cancellation token every time we start analysis like we used to before

* Refactor how token is generated to match old way of doing things
2024-09-16 17:33:02 -07:00
Eric Traut 1eb1bc739a
Fixed a bug that results in a false positive type error and confusing error message when assigning to a class variable that uses `Self` in its type definition. This addresses #9011. (#9013) 2024-09-16 15:28:59 -07:00
Eric Traut a203953bfe
Fixed bug that results in a confusing error message extension referencing a missing `__set__` method when assigning to a class variable that is not a descriptor object. This addresses #9011. (#9014) 2024-09-16 15:28:13 -07:00
Rich Chiodo e94fa867c5
Allow venvPath to be set in settings.json (#9007)
* Allow venvPath to be set on command line or in settings whether or not it's set in config file

* Fix setting the venvPath in the extension
2024-09-16 10:19:25 -07:00
Eric Traut f3ed4990d3
Fixed bug that results in incorrect type narrowing when `TypeIs` intersects `type[A]` with `type[B]`. Previously, pyright was producing `<subclass of type[A] and type[B]>` but now produces `type[<subclass of A and B>]`. This addresses #9002 and #9003. (#9005) 2024-09-16 09:22:51 -07:00
Eric Traut c799d9e718
Fixed bug that can theoretically result in spurious errors when evaluating expressions that involve parameter symbols. (#8999) 2024-09-15 17:59:18 -07:00
Eric Traut fb5cc8c30c
Fixed bug that results in a spurious "symbol refers to itself" error under very specific conditions. This addresses #4513. (#8997) 2024-09-15 08:14:52 -07:00
Eric Traut 6c2812306c
Fixed bug that results in incorrect code flow involving a call to a `NoReturn` callable with a function decorator applied. This addresses https://github.com/microsoft/pylance-release/issues/6391. (#8996) 2024-09-14 22:43:52 -07:00
Eric Traut ecdab9371c
Improved error message for type violation in assignment statement where the LHS is an instance variable reference. This addresses #8943. (#8994) 2024-09-14 20:38:09 -07:00
Eric Traut 7eb358a8e8 Fixed bug that results in incorrect reporting of the Python version in a deprecation diagnostic message. 2024-09-14 16:14:26 -07:00
Eric Traut 63c7c30c59
Expanded `reportUnnecessaryIsinstance` check to report cases where an `isinstance` or `issubclass` call always evaluates to `False`. This addresses #8961. (#8992) 2024-09-14 09:07:37 -07:00
Eric Traut 171f05214d
Fixed recent regression that results in incorrect type narrowing for `isinstance` in the negative case when using `type` as a filter. This addresses #8963 and #8988. (#8990) 2024-09-13 17:01:33 -07:00
Eric Traut d3821e9e5d
Made adjustments to `TypeForm` behaviors based on feedback on draft PEP 747. (#8989) 2024-09-13 15:35:05 -07:00
Eric Traut 9ea762f416 Improved comment for clarity. 2024-09-13 10:01:29 -07:00
Daniel Colascione edaeab2bc2
Mutate sourceFile imports list whenever it changes (#8986)
This change fixes a bug in which module imports stop resolving after
file edits that change the set of modules a file imports.

Previously, in _updateSourceFileImports, we would mutate the import
list of the source file we were updating only if the new imports list
was longer than the old list or any element mismatched between the old
and new lists. This behavior led to a situation in which, potentially
due to buffer editing, if the new import list was a prefix of the old
list, we would fail to call sourceFileInfo.mutate(). Consequently,
when those imports came back (perhaps due to further buffer editing)
we would skip adding them to the sourceFileInfo import list (because,
as we didn't call sourceFileInfo.mutate(), we falsely believe we still
had the imports). Because we skipped the addition logic, we would not
add the importing buffer to the importedBy lists of the imported
SourceFileInfo. If not updating the importedBy list ended up leaving
it empty, we regarded the imported source files as "not needed",
didn't parse them, and consequently failed to resolve symbols imported
from these modules.

Now, we call sourceFileInfo.mutate() when the old and new import lists
differ in any way, restoring correct behavior under buffer edits that
remove imports.
2024-09-13 09:58:56 -07:00
Eric Traut c3580db832
Fixed a bug that results in incorrect narrowing of types for `TypeIs` user-defined type guard in certain cases when variable type is a union. This addresses #8966. (#8981) 2024-09-12 22:31:55 -07:00
Eric Traut 10b372d777
Fixed a bug that results in incorrect evaluation of a variable in a doubly-nested loop that is assigned a value in an assignment expression. This addresses #8979. (#8980) 2024-09-12 19:08:35 -07:00
Eric Traut dd3ba0a96a
Fixed recent regression that results in a false positive error when attempting to assign the expression `type(Any)` to type `type[Any]`. This addresses #8973. (#8976) 2024-09-12 12:49:41 -07:00
Stella a0ecfe25d6
Pull Pylance with Pyright 1.1.380 (#8969)
* Push pylance changes to pyright

* Update typeForm4.py
2024-09-11 16:36:53 -07:00
Eric Traut 0d92942a42
Fixed bug that results in incorrect type narrowing for sequence patterns in the negative (fall-through) case when the subject is a tuple with an unbounded entry. This addresses #8967. (#8968) 2024-09-11 14:30:16 -07:00
Eric Traut d91a24b595 Published 1.1.380 2024-09-10 14:15:50 -07:00
Eric Traut e1fd479eaf Updated typeshed stubs to the latest version. 2024-09-10 13:52:56 -07:00
Eric Traut 8698e60c1b
Removed support for custom `callable` type guard pattern. Now that typeshed defines this with a `TypeIs`, we no longer require custom logic here. This addresses #8944. (#8954) 2024-09-10 13:47:00 -07:00
Eric Traut c83e30e0a5
Fixed several inconsistencies and bugs in the `isinstance` type narrowing code involving callables. (#8953) 2024-09-10 13:20:35 -07:00
Eric Traut 358d7dbff7
Fixed a bug that results in incorrect type narrowing for `TypeIs` when it is used with a `Callable` type form. This addresses #8951. (#8952) 2024-09-10 11:38:44 -07:00
Eric Traut 9f38f8d6b0 Removed some debugging code that was accidentally left in. 2024-09-10 09:27:36 -07:00
Eric Traut 1c4477662b Updated execution environment documentation. 2024-09-10 08:20:11 -07:00
Eric Traut 498dd2f945 Fixed bug that causes a crash in the language server under certain circumstances with partially-written code that has syntax errors. 2024-09-09 17:05:56 -07:00
Eric Traut 76ae26c6b7 Fixed a bug in the stub generator to avoid emitting a `from __future__` import statement, which has no meaning in stub files. 2024-09-09 17:04:31 -07:00
Eric Traut b2fc167735 Fixed a bug in the stub generator so it properly outputs type aliases that use the PEP 613 `TypeAlias` qualifier. 2024-09-09 17:02:52 -07:00
Eric Traut 9c52b15619
Fixed a bug that results in incorrect type narrowing for the `x is ...` (ellipsis) type guard pattern. This addresses #8939. (#8940) 2024-09-09 11:35:05 -07:00
Eric Traut ed761d9298
Fixed bug that results in incorrect type narrowing for the `in` (containment) operator when the filter includes class objects (instances of `type`). This addresses #8866. (#8935) 2024-09-08 17:21:48 -07:00
Eric Traut 8faec96982
Fixed a bug that leads to incorrect type narrowing with `isinstance` or `TypeIs` when the filter type (the second argument to `isinstance`) is a subclass of `type`. This addresses #8691 and #8686. (#8934) 2024-09-08 16:47:42 -07:00
Eric Traut d1f9cdc1b3
Did another simplification pass for isinstance type narrowing. This brings `isinstance` narrowing more closely in line with `TypeIs` narrowing. (#8931) 2024-09-08 15:51:41 -07:00
Eric Traut df4037979f Moved `AssignTypeFlags` enumeration from typeUtils to typeEvaluatorTypes module, which is a more appropriate place. 2024-09-08 14:24:46 -07:00
Eric Traut 9b40da59e6
Did another simplification pass for isinstance type narrowing. This fixes a number of inconsistent behaviors involving metaclasses. (#8929) 2024-09-08 13:26:10 -07:00
Eric Traut 6c051ca03f
Simplified check for unnecessary isinstance call. Removed a bunch of redundant code and fixed a number of bugs in the process. (#8928) 2024-09-08 09:39:59 -07:00
Eric Traut ff60144691
Removed some redundant code from the isinstance type narrowing code path. (#8925) 2024-09-07 18:01:00 -07:00
Eric Traut 5994b3a5dc
Fixed a bug that leads to a false positive "default value is specified as ..." when using `--verifytypes` and the function has a decorator applied that uses a ParamSpec. This addresses #8905. (#8924) 2024-09-07 12:07:19 -07:00
Eric Traut af65844b00
Added support for custom metaclasses that derive from `ABCMeta`. Classes instantiated from such metaclasses are now treated as abstract. This addresses #8910. (#8923) 2024-09-07 09:29:08 -07:00
Erik De Bonte 1b720001a6
Remove release.yml and trigger_pylance.yaml (#8918) 2024-09-06 14:58:54 -07:00
Eric Traut 8191861840 Changed behavior to allow a value with type `_AnnotatedAlias` to be used with an implicit `__getitem__` call even though this type is not documented or declared in typeshed. This addresses #8916. 2024-09-06 11:18:28 -07:00
Eric Traut 05435baad8
Removed support for python-2 raise statements with comma-delimited operands. (#8915)
Removed redundant logic for checking exception type in `raise x from y` statements.
Changed behavior of raise evaluation logic to allow type of exception to be `Never`. This addresses #8911.
2024-09-06 08:58:05 -07:00
Eric Traut d841fb9e91
Changed the behavior of the dictionary expansion operator (`**`) when used in an argument expression for a call and the operand is a TypedDict. It now takes into account the fact that a (non-closed) TypedDict can contain additional keys with `object` values. This new behavior is consistent with mypy. This addresses #8894. (#8908) 2024-09-05 09:56:57 -07:00
Eric Traut 97f02dff47
Fixed recent regression that results in a false positive error under very specific circumstances involving a function with a TypeVar used in both a contravariant and covariant context and combined by union with other types in the contravariant context. This addresses #8864. (#8906) 2024-09-05 09:15:48 -07:00