Commit Graph

7526 Commits

Author SHA1 Message Date
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
Eric Traut
2743ba5cbf
Fixed a bug that led to poor performance (effectively a hang) if an unannotated function is called through many (greater than 8) call expressions within a loop using different literal-value arguments each time. This addresses #7791. (#7792) 2024-04-27 15:45:29 -07:00
Eric Traut
0a8e1b7af6 Fixed documentation and json schema for reportMissingTypeStubs default. This addresses #7789. 2024-04-26 21:40:57 -07:00
Eric Traut
6950622347
Issue7779 (#7781)
* Changed `TypeIs` to use the same logic as `isinstance` type narrowing logic for consistency. This addresses #7767, #7760, and #7647.

* Fixed bug that results in a false positive error when a `yield` statement is used within a lambda following a function. This addresses #7779.
2024-04-26 09:51:58 -07:00
Eric Traut
96d0145763
Changed TypeIs to use the same logic as isinstance type narrowing logic for consistency. This addresses #7767, #7760, and #7647. (#7777) 2024-04-25 22:19:04 -07:00
Eric Traut
c2203b9aa7
Fixed bug that resulted in incorrect bidirectional type inference when calling a constructor for a generic class that defines no __new__ or __init__ method. This addresses #7764. (#7776) 2024-04-25 21:10:10 -07:00
Eric Traut
c640765de5 Changed logic that synthesizes the constructor methods for a NamedTuple subclass (using the class syntax) so the __new__ method contains parameters based on field names and the __init__ method contains a general *args: Any, **kwargs: Any parameter signature. Previously, this was swapped, but the new way is more faithful to the runtime. This addresses #7769. 2024-04-25 20:30:30 -07:00
Eric Traut
7194375bff
Fixed bug caused by incorrect synthesis of item and keys attributes for named tuple classes. This addresses #7768. (#7775) 2024-04-25 19:50:12 -07:00
Eric Traut
547a15021b
Fixed a bug that results in a false negative when using bidirectional type inference to evaluate the type of a lambda expression if the expected type is a union of two or more callables. This addresses #7772. (#7773) 2024-04-25 19:37:15 -07:00
Erik De Bonte
4bc8428d75
Follow-up pull from Pylance (#7766) 2024-04-25 07:23:15 -07:00
PylanceBot
ffcd90bb91
Pull Pylance with Pyright 1.1.360 (#7761)
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-04-24 17:58:06 -07:00
Eric Traut
f4afe405cd Published 1.1.360 2024-04-23 22:00:23 -07:00
Eric Traut
e5c0b59c77 Fixed bug that leads to incorrect metatype for a class object that is created by calling the metaclass with a two-argument form. 2024-04-23 21:58:46 -07:00
Eric Traut
d33a1051dd
Fixed bug that leads to false negative when binding an object to an overloaded method where all of the overloads have incompatible self parameter types. This addresses #7742. (#7755) 2024-04-23 21:47:13 -07:00
Eric Traut
7c8e8ba8e0 Updated typeshed stubs to the latest version. 2024-04-23 21:26:05 -07:00
Eric Traut
400bb92da0
Redesigned the handling of PEP 695-style type parameter scoping to better match the CPython runtime implementation. This addresses #7716 and #7737. (#7754) 2024-04-23 21:05:07 -07:00
Eric Traut
3875288287
Fixed a bug that results in a false positive error when bidirectional type inference is used for a dictionary comprehension when the expected type is a union. This addresses #7741. (#7751) 2024-04-23 00:01:47 -07:00
Eric Traut
cd483dcb90
Fixed bug in protocol matching that results in a false positive when the subject object is a dataclass that contains a callable. It should be considered an instance member in this case, so it should not be bound to the class. This addresses #7735. (#7749) 2024-04-22 20:47:48 -07:00
Eric Traut
d1461cee9f
Changed behavior to no longer exempt unguarded access to not-required TypedDict member within a try or with block. Previously, such errors were exempt, but this is inconsistent with other type checks in pyright which eschew the practice of using exception handling for normal code flow. This addresses #7714. (#7748) 2024-04-22 18:39:45 -07:00
Eric Traut
73d894c1be
Fixed recent regression that incorrectly narrowed the type of kwargs when used in a type guard of the form if "a" in kwargs. This addresses #7731. (#7747) 2024-04-22 18:19:10 -07:00
Eric Traut
419a8f41c1
Fixed recent regression that affected unannotated __call__ methods in a metaclass. This change aligns pyright's behavior to the typing spec. It addresses #7717. (#7746) 2024-04-22 17:50:11 -07:00
Eric Traut
9ca7cbd48c Updated documentation to show that PEP 742 is no longer in draft form. 2024-04-22 17:35:27 -07:00
Max Muoto
591b0d0a5a
Update typing docs with Pycharm usage (#7744) 2024-04-22 14:33:23 -07:00