Commit Graph

7556 Commits

Author SHA1 Message Date
Eric Traut
017f7c2767
Fixed a bug that results in incorrect type narrowing for a type guard function that uses TypeIs[type[T]]. This addresses #7946. (#7947) 2024-05-18 00:11:08 -07:00
Eric Traut
7d146aad07 Simplified isinstance code. No functional change. 2024-05-17 23:26:18 -07:00
Eric Traut
7724fce513
Fixed a bug in the code flow engine that results in incorrect type evaluation in certain cases involving codependent variables in a loop. This addresses #7466. (#7945) 2024-05-17 10:09:18 -07:00
Eric Traut
c345c561a0
Changed the handling of Enum subclasses that explicitly override value or name to avoid using the special-case logic for computing these types. This is done regardless of whether the class uses a custom metaclass. This addresses #7939. (#7941) 2024-05-16 21:04:43 -07:00
Eric Traut
7699780a0a
Fixed bug that results in a false negative when determining if a callable type is compatible with another callable type and the first has a *args parameter and the second has a single positional+keyword parameter. This addresses #7937. (#7938) 2024-05-16 17:44:12 -07:00
Eric Traut
1f16eb66b5 Fixed recent regression that results in a false positive when accessing an enum member from an instance of an enum class. This addresses #7926. 2024-05-15 20:26:27 -07:00
Eric Traut
6d79c5cada Fixed a bug that leads to a false positive error when first argument to super call is an instance of a metaclass. This addresses #7931. 2024-05-15 20:11:09 -07:00
Eric Traut
022b30a1f8 Fixed bug that results in a false negative syntax error when a PEP-695 type alias uses a keyword as a name. This addresses #7933. 2024-05-15 19:56:08 -07:00
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