Commit Graph

7526 Commits

Author SHA1 Message Date
Bill Schnurr
0618acc535
pylance-22-5-2024 -> pyright (#7980)
* pullpylance-22-5-2024

  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>
2024-05-22 15:34:30 -07:00
Raphael Boidol
766a012627
Update GitHub Actions from "actions" org & update mypy_primer for changed upload-artifacts behaviour (#7978)
* Update actions/checkout, actions/setup-node, actions/setup-python, actions/github-script

* Update actions/upload-artifact & actions/download-artifact includign migrations
2024-05-22 12:31:23 -07:00
Eric Traut
a18387f1c4 Published 1.1.364 2024-05-21 19:04:30 -07:00
Eric Traut
4a8b2dbbdd Removed unused import in test. 2024-05-21 16:45:54 -07:00
Eric Traut
b93dc627fc Added small memory and performance optimization. 2024-05-21 13:00:33 -07:00
Eric Traut
be320a8b08
Added support for using Literal and various other special forms in a value expression. This addresses #7547. (#7969) 2024-05-21 12:20:01 -07:00
Eric Traut
4c49f1b8cd Improved type printer (the component that converts an internal type to textual format for diagnostic messages) so it better handles special forms like Literal or unions when used in a value expression. This partly addresses #7547. 2024-05-21 10:49:29 -07:00
Eric Traut
1027400ac0
Fixed bug that leads to a false negative when calling a callback function that returns a callable with a generic parameter type. This addresses #7718. (#7965) 2024-05-21 01:47:44 -07:00
Eric Traut
582ead0aa0 Updated typeshed stubs to the latest version. 2024-05-21 01:02:48 -07:00
Eric Traut
e4e48b9d26 Added test case for #7250, which was fixed by the same fix for #7141. 2024-05-21 00:02:51 -07:00
Eric Traut
39962012cb Added test case for previous commit. 2024-05-20 23:58:55 -07:00
Eric Traut
9f76ed501e
Fixed a bug that resulted in an infinite loop when a function that uses an *args: *Ts parameter is passed as an argument to itself. This partially addresses #7141. (#7964) 2024-05-20 23:35:11 -07:00
Eric Traut
51225759d2
Fixed regression that results in incorrect type evaluation for annotations that involve nested protocols (such as P[P[T]]). This addresses #6767. (#7963) 2024-05-20 19:34:46 -07:00
Eric Traut
7fb7b4158d
Added support for recent addendum to typing spec that provides a special case for dataclasses so ClassVar and Final can be used together to distinguish between a regular Final instance variable and a ClassVar that is also Final. This addresses #7959. (#7962) 2024-05-20 15:52:34 -07:00
Eric Traut
24787dad22 Revert "Update GitHub Actions from "actions" org to resolve Node.js deprecations (#7956)"
This reverts commit 17921d4f1e.
2024-05-20 15:42:56 -07:00
Eric Traut
d1515002d9 Fixed a bug in the dataclass "converter" support that resulted in an error if the converter is tuple. This addresses https://github.com/microsoft/pylance-release/issues/5391. 2024-05-20 12:53:20 -07:00
Raphael Boidol
17921d4f1e
Update GitHub Actions from "actions" org to resolve Node.js deprecations (#7956) 2024-05-20 08:53:43 -07:00
Eric Traut
dbac83d45c
Fixed a bug that results in a false negative when a generic function has a parameter with a generic type and a default argument value. This could lead to a typing hole when considering subtyping rules for callables. This addresses #7288. (#7954) 2024-05-19 21:34:08 -07:00
Eric Traut
0b7860b15e Fixed regression related to "converter" field parameter for dataclasses when the converter refers to a generic class constructor. This addresses #7713. 2024-05-18 14:22:47 -07:00
Eric Traut
7426e71d2c Changed support for dataclass "converter" field parameter to be off by default. The "enableExperimentalFeatures" must now be enabled to use this feature. If and when PEP 712 is approved, we can move out of experimental. 2024-05-18 14:21:46 -07:00
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