Commit Graph

17 Commits

Author SHA1 Message Date
Eric Traut
5b3523ff53
Added support for parameter type inference for lambdas whose parameters include default arguments. This is analogous to the logic used for unannotated function parameters with default arguments. This addresses #6558. (#6563) 2023-11-27 17:51:31 -08:00
Eric Traut
501681295b
Modified type inference logic so methods that raise an exception whose type derives from NotImplementedError is not inferred to return NoReturn. Previously, only NotImplementedError was exempted, not subclasses. This addresses https://github.com/microsoft/pyright/issues/5608. (#5609)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2023-07-29 22:45:10 -06:00
Eric Traut
a00a026953 Fixed capitalization inconsistency in docs. 2023-03-06 18:12:20 -07:00
Eric Traut
08b2cb4698 Did a consistency pass on documentation markdown. 2023-03-06 18:10:33 -07:00
Christian Clauss
7be1d77360
Fix typo (#4398) 2023-01-04 05:53:27 -07:00
Eric Traut
2f21a0d975 Fixed a bug in the dictionary inference documentation. 2022-12-16 19:27:12 -08:00
Eric Traut
d5d27505ef Updated types in documentation to use PEP 604 syntax. 2022-10-24 20:06:21 -07:00
Eric Traut
c061adb5b8 Fixed typo in documentation. 2022-02-22 16:01:28 -07:00
Eric Traut
450524d004 Added support for parameter type inference based on annotated base class method signatures and on default argument expressions. 2022-02-22 12:42:14 -07:00
Eric Traut
17f37a2482 Fixed a typo in the documentation. 2022-01-06 13:02:31 -07:00
sasano8
a1ebf82bb8
Ambiguous tuples become as specific as possible. (#2291)
The rationale is as follows.

>Tuple Expressions
>When inferring the type of a tuple expression (in the absence of bidirectional inference hints), Pyright assumes that the tuple has a fixed length, and each tuple element is >typed as specifically as possible.

```python
# The inferred type is Tuple[Literal[1], Literal["a"], Literal[True]]
var1 = (1, "a", True)

def func1(a: int):
    # The inferred type is Tuple[int, int]
    var2 = (a, a)

    # If you want the type to be Tuple[int, ...]
    # (i.e. a homogenous tuple of indeterminate length),
    # use a type annotation.
    var3: Tuple[int, ...] = (a, a)
```
2021-09-10 12:27:42 -07:00
Eric Traut
4f03ba88c0 Added configuration option "strictSetInference" which is analogous to "strictListInference" and "strictDictionaryInference" but specifically for set expressions. 2021-04-03 08:35:40 -07:00
Eric Traut
e5714b3365 Added smarter handling of empty lists ([]) and dicts ({}). Previously, these were inferred to have types list[Unknown] and dict[Unknown, Unknown], respectively. They are now provided with a known type if the variable is assigned a known list or dict type along another code path. 2021-03-24 13:50:59 -07:00
Eric Traut
b7ae207558 Small improvements to documentation. 2020-08-02 14:20:07 -07:00
Eric Traut
63c9b5b691 Fixed a few typos in the inference documentation. 2020-07-27 21:03:20 -07:00
Eric Traut
838b293a4f Small improvements to type inference documentation. 2020-07-15 00:26:02 -07:00
Eric Traut
531ebc4694 Added documentation for type inference. 2020-07-14 23:02:50 -07:00