Commit Graph

7548 Commits

Author SHA1 Message Date
Eric Traut
7ccf956b0f Published 1.1.363 2024-05-14 21:53:36 -07:00
Eric Traut
884301271b
Fixed a bug that results in incorrect type evaluation when a function parameterized with a TypeVarTuple is passed as an argument to another function parameterized with a TypeVarTuple. This addresses #7140. (#7920) 2024-05-14 21:48:53 -07:00
Eric Traut
eb2a1ef0ab
Removed some special-case logic that is no longer necessary. (#7919) 2024-05-14 21:03:47 -07:00
Eric Traut
468bae53e0
Changed the TypeVar scoping behavior for TypeVars that appear only within a Callable subtype within a function's declared return type. Previously, pyright scoped these TypeVars to the Callable rather than the function. This was due to issue #4285. I'm reversing this decision because it's not spec-compliant, creates a bunch of unnecessary complexity, and results in buggy behavior. This addresses #7722. (#7918) 2024-05-14 15:53:06 -07:00
Eric Traut
3ae32dc927
Fixed bug that resulted in false positive when evaluating a function call involving a TypeVarTuple under certain circumstances. This addresses #7820. (#7917) 2024-05-14 14:30:31 -07:00
Eric Traut
6c7470d51e
Fixed a bug that results in a false positive error when a decorator is applied to a property. This addresses #7740. (#7913) 2024-05-13 23:47:28 -07:00
Eric Traut
506f2c14dd
Fixed bug that results in incorrect type evaluation behavior within c… (#7912)
* Fixed bug that results in incorrect type evaluation behavior within class body of an enum class when one enum member is used to define another enum member. This involved a significant rewrite of the logic involving enum symbol evaluation. It addresses #7763.

* Add recursion protection.
2024-05-13 21:58:47 -07:00
Eric Traut
c477556fa1
Fixed bug that results in incorrect type narrowing for isinstance or issubclass type guard when the filter is a generic class whose type parameter has a default value. (#7905)
This addresses #7860.
2024-05-13 01:43:43 -07:00
Eric Traut
91dac9435e
Fixed bug that results in incorrect type narrowing for a tuple with determinate length when indexed with an out-of-bounds slice. This addresses #7864. (#7901) 2024-05-12 22:31:41 -07:00
Eric Traut
f7aba4ede4
Improved handling of constrained TypeVars when used with unary operators. This addresses #7874. (#7900) 2024-05-12 21:51:16 -07:00
Eric Traut
5817d275a2
Changed the type evaluation for type(Any) or type(x) where x is a value of type Any or Unknown. These now evaluate to type[Unknown]. (#7899) 2024-05-12 16:04:59 -07:00
Eric Traut
da446c7c6a Fixed recent regression that results in assert_type failure when a class is parameterized by a ParamSpec with a default value. This addresses #7878. 2024-05-12 00:22:58 -07:00
Eric Traut
8a5bfb975c Fixed false positive deprecatedTypingAliases deprecation for collections.abc.AbstractSet due to a recent change in typeshed stubs. This addresses #7875. 2024-05-12 00:06:29 -07:00
Eric Traut
bdb6b9dd51
Fixed bug that results in a false positive reportUnnecessaryComparison when a variable is used in a conditional expression and its type is a union that includes a Coroutine and a non-coroutine. This addresses #7881. (#7885) 2024-05-10 21:14:46 -07:00
Eric Traut
e045e1c0a2 Fixed bug that causes a false positive reportPrivateUsage error when a global or nonlocal binding is used within a class to access an outer-scoped variable. This addresses #7884. 2024-05-10 20:57:27 -07:00
Eric Traut
e654729d96 Fixed bug that resulted in diagnostics associated with the reportUnnecessaryTypeIgnoreComment check to not include the error code. This addresses #7883. 2024-05-10 16:32:17 -07:00
Eric Traut
496e50f65c Tweaked documentation. 2024-05-08 21:04:00 -07:00
Eric Traut
255c13aef2 Deferred execution of type annotations (PEP 649) did not make it into Python 3.13 and has been deferred (again) until Python 3.14. Changing pyright's logic accordingly. 2024-05-08 21:02:35 -07:00
Rich Chiodo
36e00b8785
Add note about VS code's locale being used first (#7876)
In response to https://github.com/microsoft/pyright/issues/7873
2024-05-08 11:54:50 -07:00
Eric Traut
7be85982d6 Updated manifest to reflect the correct default value for reportInvalidTypeForm. 2024-05-07 23:35:31 -07:00
Eric Traut
3af2bbc1f8 Published 1.1.362 2024-05-07 22:14:30 -07:00
Eric Traut
576d37151f
Added special-case handling for __init_subclass__ checks for classes that have ABCMeta as a metaclass. Previously, these were exempted from __init_subclass__ because ABCMeta has a custom __new__ method, but we know that this metaclass calls through to type.__new__ which calls __init_subclass__. This addresses #7819. (#7871) 2024-05-07 22:08:43 -07:00
Eric Traut
ecdea2caad Fixed a bug that resulted in a false negative when a Literal with multiple arguments is used in a value expression. It should be treated as a UnionType special form in this case. This addresses #7870. 2024-05-07 21:02:47 -07:00
Eric Traut
286fdf95f9 Fixed recent regression that resulted in incorrect type narrowing when a *args: P.args parameter was used in the expression len(args) >= x. This addresses #7866. 2024-05-07 20:56:48 -07:00
Andreas Runfalk
fa2779ec4c
varaiables -> variables typo fix for English and Korean translations. (#7862) 2024-05-07 08:58:10 -07:00
Eric Traut
c49af8f349
Changed interpretation of function definitions with (*args: Any, **kwargs: Any) to be ... in compliance with latest typing spec. This addresses #7848. (#7859) 2024-05-06 23:45:41 -07:00
Eric Traut
0ead803de9 Updated typeshed stubs to the latest version. 2024-05-06 22:19:18 -07:00
Eric Traut
3ead033827
Fixed incorrect type narrowing for a class pattern argument if the class is a generic whose type parameters have default values. This addresses #7855. (#7857) 2024-05-06 22:12:21 -07:00
Eric Traut
377958a0ee
Fixed false positive when a TypeVar appears within a function type comment. This addresses #7854. (#7856) 2024-05-06 21:05:19 -07:00
Eric Traut
e7cc55ad68
Fixed a bug that results in incorrect type evaluation for a variable that uses a nonlocal or global binding within an inner scope. Such a variable should never honor the narrowed type from the outer scope. This addresses #7838. (#7846) 2024-05-05 01:02:08 -07:00
Eric Traut
88a8d90ba8
Fixed recent regression with the TypeIs type guard that resulted in incorrect type narrowing in the negative (else) case. This addresses #7837. (#7845) 2024-05-04 23:19:08 -07:00
Lucian Wischik
2935732b85
fix broken link in configuration.md (#7844) 2024-05-04 19:59:51 -07:00
dependabot[bot]
14e634f1b4
Bump ejs from 3.1.9 to 3.1.10 (#7831)
Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.9...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-02 09:22:38 -07:00
Eric Traut
9ab6b6ff14
Fixed a bug that results in incorrect type narrowing in the negative (fall-through) case when a match statement includes a class pattern with a runtime-checkable protocol class. This addresses #7823. (#7829) 2024-05-01 19:13:32 -07:00
Eric Traut
bdc4b2650f Fixed a crashing bug that results from an internal assertion failure when a generic class that uses PEP 695 syntax is located within an unreachable code block. This addresses #7828. 2024-05-01 18:33:20 -07:00
Eric Traut
66ebc186e1 Fixed a bug that results in incorrect type narrowing when a match statement uses an empty (zero-element) sequence pattern and the subject expression type is a tuple that potentially (but does not always) have a zero length. This addresses #7826. 2024-05-01 18:03:55 -07:00
PylanceBot
211f8d12fc
pull-pylance-with-pyright-1.1.361-8904242021 (#7815)
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rich Chiodo <rchiodo@users.noreply.github.com>
2024-05-01 09:40:12 -07:00
Eric Traut
4ea3cd6a1f Addressed a performance issue when indexing into a value that has a type consisting of a union of many (dozens or hundreds) of tuple types. This addresses #7813. 2024-04-30 22:22:47 -07:00
Eric Traut
a042135776 Minor code improvement. Changed the name of an inner-scope variable to avoid shadowing an outer-scoped variable. No functional change. 2024-04-30 22:21:43 -07:00
Eric Traut
ab84d414f0 Published 1.1.361 2024-04-30 18:52:30 -07:00
Eric Traut
de5a4f8d4c
Fixed bug that produces incorrect output when converting to a textual representation the type type[Foo] where Foo is a type alias. This addresses #7806. (#7809) 2024-04-30 09:27:26 -07:00
Eric Traut
582a93e3fe
Fixed a bug that results in a false negative when an Unpack is used in a union. This isn't allowed. (#7805) 2024-04-30 01:46:43 -07:00
Eric Traut
42962e796f Split out type evaluator tests into more files and rebalanced them to take advantage of machines with more cores. On my new MacBook Pro, this drops the time to run tests from 45s to 23s. 2024-04-29 22:23:50 -07:00
Eric Traut
01c512ee7e Fixed bug that resulted in incorrect evaluation of an identifier used in a method parameter type annotation if it shadows a forward reference in a class scope when the method is using PEP 695 type parameters. This addresses #7800. 2024-04-29 22:06:54 -07:00
Eric Traut
0af66f4468
Fixed a bug that results in incorrect type evaluation when a global (module-scoped) variable is captured within an inner scope and the variable is not modified anywhere below the inner scope. It's possible in this case for the variable to be modified by code outside of the module. This addresses #7780. (#7803) 2024-04-29 16:16:32 -07:00
Eric Traut
fcf5b372be Changed the tokenizer so it is bug-for-bug compatible with the CPython tokenizer in versions 3.10 and newer in the case where a backslash (continuation character) is located by itself on a line. This addresses #7799. 2024-04-29 16:00:54 -07:00
Eric Traut
1aed0e3261
Fixed a false negative that occurs when reassigning a Final variable within a class body. This addresses #7797. (#7801) 2024-04-29 15:36:45 -07:00
Eric Traut
4c1eb615af
Fixed a bug that results in a false positive error when Callable() is used as a class pattern and the subject type is Any or Unknown. This addresses #7794. (#7796) 2024-04-28 18:44:26 -07:00
Eric Traut
556608dffd Fixed a bug that leads to an infinite loop when performing protocol matching under certain circumstances that involve recursive protocol definitions. This addresses #7786. 2024-04-27 19:33:17 -07:00
Eric Traut
47c53f9b5b Fixed a bug that results in a false positive error when using __extra_items__ (PEP 728) with a TypedDict imported from typing_extensions. This addresses #7784. 2024-04-27 15:52:43 -07:00