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
f22576f0f8
Moved check for invalid use of class-scoped TypeVar within a self
annotation in __init__
. It was previously reported under reportGeneralTypeIssues
, but it's now moved to reportInvalidTypeVarUse
. This was done to help typeshed maintainers migrate away from this pattern. https://github.com/python/typeshed/pull/11780#issuecomment-2070101577
2024-04-22 09:51:32 -07:00
Eric Traut
c7168d7068
Added support for @deprecation messages for decorators that wrap a function in a callable object. The deprecated message is now propagated through the ParamSpec and the __call__
method. This addresses #7732 .
2024-04-21 21:22:07 -07:00
Heejae Chang
0127fd67ad
log type evals perf when option is on ( #7729 )
2024-04-19 18:11:58 -07:00
Heejae Chang
a8399d3933
Don't use Uri.Empty for default workspace. ( #7654 )
...
* Don't use Uri.Empty for default workspace.
* addressed PR feedback
2024-04-17 16:31:52 -07:00
Erik De Bonte
69ded75d4b
Loc update from Pylance ( #7720 )
2024-04-17 13:00:35 -07:00
Erik De Bonte
fc1b547130
Push pylance changes to pyright ( #7719 )
...
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-17 11:46:31 -07:00
Eric Traut
cc3467fda4
Published 1.1.359
2024-04-16 17:15:25 -07:00
Eric Traut
8912c884ce
Fixed bug that results in false positive error under certain circumstances that involve unions of TypeVars in an invariant context. This addresses #6957 . ( #7709 )
2024-04-15 23:09:21 -07:00
Eric Traut
8a7aed5983
Added a check for the case where a frozen dataclass overrides a field from its parent class but doesn't provide a default value (where its parent does). This can result in a type violation if the parent's default value is not compatible with the child's (covariant) field type. This addresses #7702 . ( #7704 )
2024-04-14 11:39:26 -07:00
Eric Traut
b1c436842c
Changed behavior of conversion from class constructor to callable to conform to honor return type of the __new__
method. This addresses #7687 . ( #7701 )
2024-04-13 23:11:53 -07:00
Eric Traut
71a3b60960
Changed behavior of conversion from class constructor to callable to conform to honor the annotated type of self
in the __init__
method. This addresses #7688 . ( #7699 )
2024-04-13 22:06:32 -07:00
Eric Traut
43fe9a7e2c
Changed behavior of conversion from class constructor to callable to conform with the typing spec in the case where the __new__
method of the class returns a value that indicates the __init__
method should be ignored. This addresses #7686 . ( #7698 )
2024-04-13 21:41:56 -07:00
Eric Traut
74880b87d3
Fixed broken build. I forgot to check in a test change.
2024-04-13 21:18:03 -07:00
Eric Traut
653e1609e7
Modified behavior in constructor call code that previously applied some (now non-compliant) heuristics to reconcile a metaclass __call__
method with a __new__
method. The new behavior is now compliant with the typing spec.
2024-04-13 21:07:40 -07:00
Eric Traut
9d87fe1079
Changed the behavior when invoking constructor for type[T]
where T
is a TypeVar with no explicit upper bound (and therefore has an implicit upper bound of object
). According to the newly-clarified typing spec, this should enforce the constructor signature of object
. ( #7697 )
2024-04-13 21:05:39 -07:00
Eric Traut
7f46092aef
Fixed a bug that leads to a false negative when an unparenthesized assignment expression is used in a dictionary key within a dictionary expression or comprehension. This addresses #7694 . ( #7696 )
2024-04-13 20:40:30 -07:00
Eric Traut
2e537e9a0f
Updated logic for converting a class constructor to a callable to conform to the newly-updated typing spec. This addresses #7684 and #7685 . ( #7693 )
2024-04-13 20:16:47 -07:00
Eric Traut
00d8f81a1c
Fixed a bug that results in incorrect type evaluation when assigning a function with a NoReturn
return type to a Callable[..., T]
.
2024-04-13 18:39:18 -07:00
Eric Traut
5c480848ce
Refactored the logic related to conversion of a class constructor to a callable in prep for further bug fixes. No functional change.
2024-04-13 18:33:33 -07:00
Eric Traut
19183640d8
Fixed a bug in bindFunctionToClassOrObject function that resulted in incorrect results when binding a class object to a method in its metaclass. Also renamed the treatConstructorAsClassMethod
parameter for clarity.
2024-04-13 18:27:30 -07:00
Eric Traut
975c846895
Fixed bug that results in incorrect type evaluation when solving a ParamSpec type when there are multiple constraints provided. ( #7692 )
2024-04-13 17:34:02 -07:00
Eric Traut
567d025f48
Added missing check for the errant use of class-scoped type variables in a type annotation for the "self" parameter within an "__init__" method. The typing spec now clarifies that this is illegal and should generate an error. This addresses #7683 . ( #7691 )
2024-04-13 09:49:17 -07:00
Eric Traut
d7dce3b6a8
Modified handling of annotated self
parameter in __init__
method when evaluating constructor call so pyright conforms to the latest typing spec. This addresses #7682 . ( #7690 )
2024-04-13 09:31:11 -07:00
Eric Traut
dfe428190c
Fixed bug that results in a spurious reportAbstractUsage
error when an abstract class is captured through a type[T]
. This addresses #7680 . ( #7681 )
2024-04-12 23:10:30 -07:00
Eric Traut
92f2284d24
Changed behavior when evaluating the upper bound expression, value constraints expression, or default expression for a PEP-695 type parameter. At runtime, these are always evaluated in a deferred manner even if they are not quoted. Pyright now follows the runtime behavior. This addresses #7678 .
2024-04-12 14:08:05 -07:00
Eric Traut
f2e277aa5c
Fixed recent regression that results in a false positive error when applying a @property
decorator to a method that has already had a decorator applied to it. This addresses #7667 . ( #7671 )
2024-04-11 20:44:46 -07:00
Eric Traut
dd09712579
Extended type narrowing logic for in
and not in
operators that target TypedDicts to also support constrained TypeVars that use TypedDicts as value constraints. This addresses #7666 . ( #7670 )
2024-04-11 17:53:24 -07:00
Eric Traut
8c7e67d3c7
Fixed a bug that leads to inconsistent behaviors when an assignment leads to a type violation. When assigning to a local variable, the target expression is not "narrowed" to include the assigned type in this case. The new behavior applies this same behavior when assigning to instance or class variables. This addresses #7664 . ( #7669 )
2024-04-11 17:53:09 -07:00
Eric Traut
c212c2374f
More diagnostic message improvements: switched from "cannot assign to type" to "incompatible with type" for consistency and clarity.
2024-04-11 17:24:15 -07:00
Eric Traut
27e6b0e054
Improved some diagnostic messages, moving away from the term "member" to prefer "attribute". This partly addresses #7664 .
2024-04-11 16:52:10 -07:00
Erik De Bonte
d45ea4cea8
Push pylance changes to pyright ( #7663 )
...
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-10 14:48:46 -07:00
Eric Traut
98d1523077
Expanded support for len(x) == L
type guard pattern (where x is a tuple) to support <
, <=
, >
and >=
comparisons as well. This addresses #7655 . ( #7657 )
2024-04-09 23:13:17 -07:00
Eric Traut
989ee29c0b
Published 1.1.358
2024-04-09 19:31:43 -07:00
Eric Traut
ad1c378268
Added an error message for a Literal
type annotation that includes a string with a named unicode escape sequence. These are not supported.
2024-04-09 17:26:42 -07:00
Heejae Chang
bd08098c5d
Skip unnecessary py.typed file exist checks. ( #7652 )
...
* skip unnecessary py.typed file exist checks.
* passed wrong uri
* PR feedbacks
* more comments
* PR feedbacks
2024-04-09 14:36:43 -07:00
Eric Traut
e9d19b5520
Improved error handling for quoted annotations. Bytes, raw strings, and f-strings are not allowed according to the typing spec. This addresses #7640 . ( #7641 )
2024-04-08 12:40:40 -07:00
Eric Traut
d16990abc1
Fixed bug that results in inconsistent type narrowing on assignment based on whether the assignment occurs within the same statement that includes the (declared) type annotation for the variable and whether the type annotation is provided as a type comment. This addresses #7537 . ( #7638 )
2024-04-07 23:13:02 -07:00
Eric Traut
e65ac3854d
Fixed a bug that results in a false negative when a generic function returns a Callable type that is specialized to include a live (in-scope) type variable. This addresses #7542 . ( #7634 )
2024-04-07 11:36:31 -07:00
Eric Traut
3b70417dd5
Fixed bug that results in incorrect type evaluation in cases where a generic function returns a callable, and the function is called with a higher-order generic function as an argument. This addresses #7386 . ( #7630 )
2024-04-06 23:16:24 -07:00
Eric Traut
cfefcf49f5
Updated typeshed stubs to the latest version.
2024-04-06 17:50:34 -07:00
Eric Traut
628e246887
Fixed a bug that results in a false positive error under certain circumstances when a TypeVar or TypeVarTuple is being solved with literal values in both an invariant and non-invariant context. This addresses #7562 . ( #7629 )
2024-04-06 14:41:22 -07:00
Eric Traut
4149eb3eda
Fixed bug that results in an intermittent false positive "circular dependency" error for fields within a dataclass. This addresses #7516 . ( #7625 )
2024-04-05 22:03:03 -07:00
Eric Traut
39dfca8acd
Added accessor method for class symbol table. This is in preparation for a bug fix for #7516 .
2024-04-05 21:52:53 -07:00
Eric Traut
6d1a5fd9f7
Added support for narrowing of subject subexpression within a match statement for references to the subexpression after the completion of the match statement. This addresses #7620 . ( #7621 )
2024-04-04 23:05:55 -07:00
Eric Traut
627d3ded61
Modified the handling of enum class attributes so those with private (mangled) names are exempted from being considered enum members. This reflects the runtime behavior. This addresses #7619 .
2024-04-04 16:47:01 -07:00
Eric Traut
aff916f0cd
Added optimization for TypedDict type assignments. Under certain circumstances (e.g. when comparing large unions of TypedDict types), this can save significant time. This addresses #7617 .
2024-04-04 14:43:56 -07:00
Eric Traut
476447cb65
Fixed a bug that results in incorrect type evaluation when a sequence pattern in a match
statement includes a *
element and the subject includes a tuple with an element with indeterminate length. This addresses #7613 . ( #7616 )
2024-04-04 10:06:35 -07:00
Eric Traut
26db037205
Fixed non-compliance issue with TypeIs
, which is documented to have an invariant type parameter. This addresses #7615 .
2024-04-04 08:27:31 -07:00
Erik De Bonte
727bce6c01
Pull Pylance with Pyright 1.1.357 ( #7610 )
2024-04-03 17:28:33 -07:00
Eric Traut
1eb0c99f2c
Eliminated the need to retain a reference to the file contents in the parse tree. This helps pave the way for dropping the file contents altogether for memory savings.
2024-04-03 11:52:21 -07:00
Rich Chiodo
ed1dbe2132
Fix crash when imports are not resolved ( #7608 )
...
* Fix crash when imports are not resolved
* Fix other usages of resolvedPath
2024-04-03 11:23:11 -07:00
Eric Traut
8752be7a73
Published 1.1.357
2024-04-03 07:45:28 -07:00
Eric Traut
b6c8b7f73d
Fixed a bug that results in incorrect inferred parameter types for an unannotated method in a subclass when the parent class method contains function-scoped TypeVars. This addresses #7606 .
2024-04-03 07:41:55 -07:00
Rich Chiodo
4106a09001
Share heap usage numbers to support cache cleanup in VS code ( #7605 )
...
* Pass shared array buffer around for shared heap stats
* Put back skip logic for background analysis
* Review feedback
2024-04-02 16:49:40 -07:00
Eric Traut
5fd8830666
Refactored tokenizer and parser output to help reduce the amount of memory needed. ( #7602 )
2024-04-02 16:01:29 -07:00
Eric Traut
0b30e87de2
Improved return result for synthesized get
method for closed TypedDict
classes (as defined in PEP 728).
2024-04-02 07:47:16 -07:00
Eric Traut
dab9c8f20b
Improved diagnostic message for access to unknown member in the case where the user probably meant to access an item in a TypedDict but used a member access expression rather than an index expression. This addresses #7579 .
2024-03-31 22:31:06 -07:00
Eric Traut
2b29345060
Improved comment in completion provider. No functional change.
2024-03-31 22:30:05 -07:00
Eric Traut
7bc313e062
Fixed a bug that results in a false positive error when an unpacked TypeVarTuple is used in a function defined with PEP-695 syntax. This addresses #7588 . ( #7599 )
2024-03-31 21:47:03 -07:00
Eric Traut
efb49124fb
Fixed inconsistent handling of literal values in a list comprehension. This addresses #7586 . ( #7598 )
2024-03-31 16:15:11 -07:00
Eric Traut
b085a2669a
Changed the handling of Final
variables (that are not explicitly marked ClassVar
) within dataclass class bodies. This is consistent with the runtime and [this proposed change to the typing spec]( https://github.com/python/typing/pull/1669 ).
2024-03-31 15:07:14 -07:00
Eric Traut
7997351885
Enhanced discriminated class support to include not only literal field values but also None
. This addresses #7590 . ( #7592 )
2024-03-29 21:45:18 -06:00
Eric Traut
e4f3d618d8
Fixed bug that results in a type not being narrowed when using the K in TD
type guard pattern (where TD
is a TypedDict and K
is a literal key). Narrowing was skipped if the RHS operand was not a simple identifier. This addresses #7589 .
2024-03-29 21:37:37 -06:00
Eric Traut
0668724375
Refactored createFunctionFromConstructor for readability and maintainability. No functional change.
2024-03-28 11:28:21 -06:00
Eric Traut
c29473ab0f
Enhanced dictionary type evaluation to support dictionary items that overwrite previous dictionary items. Only the last value type is now considered, so if previous values (which are overwritten) would otherwise violate typing rules, this no longer generates a type error.
2024-03-27 21:56:26 -06:00
Eric Traut
8312bbee9d
Fixed a type hole when a dictionary expression includes a dictionary expansion operator that acts on a non-closed TypedDict. This addresses #7577 . ( #7582 )
2024-03-27 21:33:06 -06:00
Eric Traut
fc41d35343
Fixed a bug that results in incorrect type narrowing of enums that derive from enum.Flag
. In this case, we can't use enum expansion to a union of literals. This addresses #7576 . ( #7580 )
2024-03-27 18:04:50 -06:00
Eric Traut
a33feda80f
Fixed bug that results in false negative when a __new__
or __init__
method cannot be bound without a type violation. This bug was found when writing a chapter on "constructors" for the typing spec. ( #7573 )
2024-03-27 11:56:52 -06:00
Eric Traut
436c72c0b7
Added support for negative (fall-through) type narrowing for subject subexpressions in match
statement when subject consists of a tuple expression and patterns exhaustively match the tuple. This addresses #7568 .
2024-03-27 09:51:26 -06:00
Eric Traut
b3723da1c5
Fixed bug that results in a false positive error when explicitly calling __new__
on a dataclass, namedtuple, or TypedDict. These classes all require synthesized __new__
methods. This addresses #7567 .
2024-03-27 08:32:46 -06:00
PylanceBot
6652c4a818
pull-pylance-with-pyright-1.1.356-8444976018 ( #7566 )
...
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-03-26 18:26:35 -07:00
Eric Traut
9f02004791
Published 1.1.356
2024-03-26 18:48:57 -06:00
Eric Traut
1001904ff5
Fixed a bug that results in a false positive reportImplicitOverride
diagnostic if the class derives from an Unknown or Any class. This addresses #7560 .
2024-03-26 08:28:44 -06:00
Eric Traut
6ef2ca1b27
Updated typeshed stubs to the latest version.
2024-03-25 17:31:40 -06:00
Heejae Chang
1110ff90e4
push pylance to pyright ( #7558 )
2024-03-25 14:50:25 -07:00
Eric Traut
7cf91f78a2
Changed the logic for metaclass instance variable lookups to ignore the lookup if the metaclass MRO contains an unknown class. This addresses #7556 .
2024-03-25 09:02:06 -06:00
Eric Traut
fe41569755
Fixed a bug that results in a false positive when a class-scoped TypeVar used within a method has a default that refers to another class-scoped TypeVar. This addresses #7553 . ( #7554 )
2024-03-24 16:03:00 -06:00
Eric Traut
69a9151674
Added check for the use of a non-runtime-checkable protocol class in a class pattern. This generates an exception at runtime. This addresses #7551 .
2024-03-24 11:46:16 -06:00
Eric Traut
bb95091f1c
Fixed bug that results in incorrect type narrowing in the negative (fall-through) case when a runtime-checkable protocol class is used as a class pattern with arguments within a match statement. This addresses #7550 . ( #7552 )
2024-03-24 11:41:24 -06:00
Eric Traut
3da27fd549
Fixed bug that resulted in a false positive error if a PEP-695 type
statement uses a type parameter and encloses the RHS in quotes. This addresses #7538 .
2024-03-21 14:12:49 -06:00
Erik De Bonte
a6e787fd4e
Use hex char codes and show code points for surrogate pairs ( #7541 )
2024-03-21 12:44:55 -07:00
Erik De Bonte
7f468b8c5b
Update Unicode range tables to match Unicode 15.1 ( #7539 )
2024-03-21 12:16:18 -07:00
Eric Traut
52a47010b9
Tweaked bidirectional type inference behaviors for lists to improve certain inference cases. This addresses #7527 . ( #7528 )
2024-03-20 13:06:06 -06:00
Eric Traut
01eaa6fa64
Fixed bug that results in a false positive error when a class-scoped TypeVar with a default that references another class-scoped TypeVar is used in a method signature in that class. This addresses #7525 .
2024-03-20 11:36:51 -06:00
Eric Traut
a2831b7338
Published 1.1.355
2024-03-20 00:07:43 -06:00
Eric Traut
8c0f8a968a
Fixed bug that results in false positive error when a __new__
method in a metaclass uses PEP 692 (unpacked TypeDict) to annotate its **kwargs
parameter. This addresses #7514 . ( #7518 )
2024-03-19 03:26:02 -06:00
Eric Traut
02a66c5e66
Expanded handling of python versions to handle more than just major/minor version numbers. Pyright now handles micro, releaseLevel, and serial numbers as well. This addresses #7132 . ( #7510 )
2024-03-18 00:56:18 -06:00
Eric Traut
5a64ddfe5e
Fixed a bug that results in a false positive in a complex situation that involves generic protocols, properties, and mix-in classes. This addresses #7400 . ( #7506 )
2024-03-17 10:36:21 -06:00
Eric Traut
c7beec11c2
Fixed bug that results in a false positive "overload implementation does not match overloads" diagnostic when positional-only and keyword-only parameters are involved. This addresses #7473 .
2024-03-16 17:14:51 -06:00
Eric Traut
b0d18cff0c
Fixed bug that results in a false positive error when a base class defines a writable property and a subclass writes to the property. This addresses #7478 .
2024-03-16 13:22:12 -06:00
Eric Traut
cb2c493dab
Fixed a bug that results in a false positive error in certain circumstances involving a TypeVarTuple used within an overload. This addresses #7502 .
2024-03-16 13:14:06 -06:00
Eric Traut
0f9dc4758f
Fixed bug that results in a false negative when overriding a method that has keyword parameters with a method that has a *args
parameter. This addresses #7480 . ( #7501 )
2024-03-16 11:48:08 -06:00
Eric Traut
7320a6d31a
Improved validation for except
and except*
statements to catch some previously-undetected invalid cases. This addresses #7483 . ( #7500 )
2024-03-16 10:28:55 -06:00
Eric Traut
8115955fae
Fixed bug that results in false positive when a list or set expression is evaluated using bidirectional type inference when the expected type is MutableSet
or MutableSequence
. This addresses #7498 . ( #7499 )
2024-03-16 00:27:38 -06:00
Eric Traut
114817af10
Updated typeshed stubs to the latest. This version of typeshed replaces the older-style positional-only parameters with PEP 570 syntax. ( #7493 )
2024-03-15 08:48:52 -06:00
Eric Traut
ca142066b3
Fixed bug that results in false positive when implicitly specializing a class parameterized by a TypeVarTuple when there is no default. This addresses #7489 . ( #7491 )
2024-03-15 01:00:00 -06:00
Eric Traut
c6f8b83c4a
Renamed typeUtils function for consistency.
2024-03-14 23:53:21 -06:00
Eric Traut
18243af812
Fixed bug that results in a false negative when a TypeAliasType object is used in a class pattern. This addresses #7485 . ( #7486 )
2024-03-14 13:43:02 -06:00
Eric Traut
d7dc004c78
Fixed a bug that results in incorrect type evaluation if a list expression includes a generator expression. This addresses #7481 .
2024-03-14 10:54:44 -06:00
PylanceBot
6c4b329177
pull-pylance-with-pyright-1.1.354 ( #7476 )
...
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-13 11:03:37 -07:00
Eric Traut
0a73f4b0f5
Published 1.1.354
2024-03-13 09:22:00 -06:00
Eric Traut
0334a44b83
Fixed a bug that made locale overrides through environment variables no longer work on node 21. This change removes the ability to override the localized language through the use of the global navigator
object. This previously applied only to browser, but now node 21 supports this, which means that pyright users had no way to override it. If the pylance team wants localization to work in a browser, they'll need to find a better way to abstract this so it doesn't break pyright. This addresses #7439 .
2024-03-12 00:38:05 -06:00
Eric Traut
6a042f7b58
Added new reportUnhashable
diagnostic rule. This addresses #7462 . ( #7464 )
2024-03-12 00:34:58 -06:00
Eric Traut
3ccd7b87b5
Fixed a bug that results in a false negative when a class explicitly inherits from a protocol that defines an instance variable but the child re-declares as a ClassVar
without an explicit type. This addresses #7455 . ( #7463 )
2024-03-12 00:29:01 -06:00
Rich Chiodo
06bc912e38
Save some memory in token creation ( #7434 )
...
* Save some memory in token creation
* Found another 200k
* Fix wrong way to check for undefined
* Back out unnecessary regex change
* Remove 'ExceedsMaxSize'
2024-03-11 09:30:48 -07:00
Eric Traut
6e73064841
Fixed a bug that results in a false positive under certain circumstances when defining a type alias using the old typing.TypeAlias
annotation. This addresses #7457 . ( #7458 )
2024-03-11 09:40:44 -06:00
Eric Traut
0ff8b5aa1f
Changed the behavior when accessing a class attribute from a generic class that is not specialized. The class is now automatically specialized in the case using default type parameter values (from PEP 696) or Unknown. This change is required for conformance with PEP 696. It addresses #7445 . ( #7454 )
2024-03-11 00:51:05 -06:00
Eric Traut
33cab2aefe
Fixed bug that resulted in a false positive under certain circumstances when a constrained TypeVar is used as the default for another constrained TypeVar. This addresses #7446 .
2024-03-10 16:17:57 -06:00
Eric Traut
d1b2f3331b
Fixed style issue.
2024-03-10 14:58:00 -06:00
Eric Traut
37ecc8d0bb
Fixed bug that resulted in false negative when narrowing a constrained or bound TypeVar with a complex()
or float()
class pattern. This addresses #7449 .
2024-03-10 14:30:45 -06:00
Eric Traut
1ff3820b34
Fixed bug that results in false positive when a generic class or type alias uses a TypeVarTuple followed by one or more ParamSpecs that have default values. This addresses #7444 .
2024-03-10 13:47:23 -06:00
Eric Traut
bbd78d5090
Added check for generic classes and type aliases that include a TypeVarTuple followed by a TypeVar that has a default value. This is illegal according to PEP 696. This addresses #7443 .
2024-03-10 12:41:44 -06:00
Eric Traut
1d658bb835
Fixed two bugs that resulted in false negatives when redefining a constant variable with a non-variable symbol and when redefining a Final variable with a non-variable symbol. This addresses #7440 .
2024-03-09 18:07:57 -07:00
Eric Traut
209fac9a2c
Enhanced handling of type
function when it is passed a class. Pyright previously evaluated this as Any
, but now it returns the class' metaclass. This addresses #7437 .
2024-03-09 08:34:13 -07:00
Eric Traut
39960f39e4
Fixed a bug that resulted in an incorrect type evaluation when an augmented assignment is used within an inner-scoped function to add a constant to a variable. Literal math should not be used in this case. This addresses #7431 . ( #7436 )
2024-03-08 21:59:50 -07:00
PylanceBot
a612aa9871
[PylanceBot] Pull Pylance with Pyright 1.1.353 ( #7428 )
...
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-08 11:06:09 -08:00
Eric Traut
114501e336
Published 1.1.353
2024-03-07 21:15:42 -07:00
Eric Traut
a434dfb535
Fixed bug that resulted in a false negative when a possibly-unbound variable is captured by an inner scope under certain circumstances. This addresses #7384 . ( #7427 )
2024-03-07 20:12:20 -07:00
Eric Traut
38123df9e9
Fixed a bug that results in incorrect type narrowing behavior for member access expressions under certain circumstances. This addresses #7414 . ( #7426 )
2024-03-07 18:38:38 -07:00
Eric Traut
34faf10e13
Removed inappropriate use of typeAtStart value in code flow engine.
2024-03-07 18:05:59 -07:00
Eric Traut
e39bc677af
Further simplified interface to code flow engine. No functional change.
2024-03-07 18:05:59 -07:00
Erik De Bonte
6a8ae9215a
Show str
method docstrings when called on LiteralString
( #7388 )
2024-03-07 13:10:27 -08:00
Eric Traut
bf0388ba57
Fixed a bug in the isinstance
type guard logic. It was not properly handling tuples that included unions. This addresses #7422 .
2024-03-07 13:45:13 -07:00
Eric Traut
1536aa5f4b
Simplified interface to code flow engine by moving some parameters to options object. No functional change.
2024-03-07 01:13:27 -07:00
Eric Traut
aea1839e7b
Fixed hard-coded type information for module attribute __package__
. It should be str | None
rather than str
. This addresses #7408 . ( #7409 )
2024-03-06 09:23:07 -07:00
Eric Traut
e8e8464038
Fixed a regression that caused the signature help provider to not display the __new__
method of a constructor if it is overloaded. This addresses #7405 .
2024-03-05 15:56:15 -07:00
Eric Traut
f27b71e236
Fixed a bug that results in incorrect type evaluation when an index expression is assigned a value within a doubly-nested loop under certain circumstances. This addresses #7381 .
2024-03-03 14:11:26 -07:00
Eric Traut
9dce19cc87
Fixed a bug that results in a false positive error when expanding the type arguments to a TypeVarTuple under certain circumstances. This addresses #7389 . ( #7390 )
2024-03-03 00:35:43 -07:00
Eric Traut
c64f9b3f1f
Improved support for instance variables whose type is declared in a metaclass. Pyright now honors this type and enforces type consistency in derived classes. This addresses #7372 . ( #7387 )
2024-03-01 11:28:07 -07:00
Eric Traut
97267a53d6
Added check for inappropriate use of Annotated
passed as second argument to NewType
call. This addresses #7383 .
2024-03-01 09:15:26 -07:00
Eric Traut
9fd49f6a13
Fixed a bug that leads to a false positive error when a match
statement is used in a loop and the subject expression is potentially narrowed as a result of the match
statement. This addresses #7371 . ( #7377 )
2024-02-29 12:15:32 -07:00
Eric Traut
28e71ace0d
Fixed a bug that results in a false negative when a dundered method overrides a base class method of the same name and uses different parameter names along with different types. This addresses #7373 . ( #7376 )
2024-02-29 10:54:40 -07:00
Rich Chiodo
ab402404b3
Drop support for node 12 ( #7375 )
...
* Drop support for node 12
* Forgot to update package-lock.json
2024-02-29 10:47:42 -07:00
Eric Traut
1f8fd8e2b0
Enabled PEP 705 and PEP 696 functionality without the use of enableExperimentalFeatures now that they are accepted.
2024-02-29 09:34:35 -07:00
Eric Traut
e19d1e7758
Fixed a couple of translation bugs for French.
2024-02-29 00:46:07 -07:00
Eric Traut
08397a0db3
Published 1.1.352
2024-02-28 16:59:21 -07:00
Eric Traut
3586183cd8
Updated closed TypedDict implementation to match latest thinking in typing forum. It is now generally agreed that a dict
cannot be assigned to a closed TypedDict under any circumstance. https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items
2024-02-28 16:45:57 -07:00
Eric Traut
c81b09e595
Changed behavior of command-line "--pythonversion" and "--pythonplatform" options so they now override the same-named options in the config file. This addresses #7330 .
2024-02-28 16:36:49 -07:00
Eric Traut
1c84fc0062
Fixed a bug that results in an incorrect "Unbound" type evaluation for a variable assigned within a loop. This addresses #7217 . ( #7361 )
2024-02-28 00:45:13 -07:00
Eric Traut
495bd5b36f
Fixed a bug that results in a false positive error when an await
expression is passed as an argument to an overloaded function. This addresses #7222 .
2024-02-28 00:22:46 -07:00
Eric Traut
8e184445e2
Fixed a bug in the import resolver that resulted in an incorrect resolution when an import within a __init__.py
file uses the form from .a import a
. This addresses #7233 . ( #7360 )
2024-02-27 20:05:45 -07:00
Eric Traut
a8ee9f5554
Added missing check for inappropriate use of InitVar
outside of a dataclass.
2024-02-27 18:52:11 -07:00
Eric Traut
afc6bca5ca
Refined the heuristic for when to use bidirectional type inference for the RHS of and
and or
operators. This addresses #7245 . ( #7348 )
2024-02-26 14:25:05 -07:00
Eric Traut
e50cb1c315
Improved handling of enum.nonmember
in cases where the attribute has a declared type. This addresses #7346 .
2024-02-26 12:16:14 -07:00
Eric Traut
162d6c39ae
Fixed a bug that results in a false negative when passing an unpacked dict of the wrong type to a function that contains a positional-only parameter marker plus one or more keyword parameters. This addresses #7271 . ( #7341 )
2024-02-25 20:14:09 -07:00
Eric Traut
b04f03d383
Fixed a bug that leads to a false positive type violation when reassigning a value within a loop and the target variable has a declared type of a constrained type variable. This addresses #7302 . ( #7340 )
2024-02-25 19:48:01 -07:00
Eric Traut
a8bc2bdf59
Fixed style issue.
2024-02-25 19:04:18 -07:00
Lucian Wischik
c0fbb93ee4
Debugging ( #7332 )
...
* launch.json CLI debug that bypasses webpack
I got a bit irritated in my edit-build-debug inner loop with the time to run webpack.
This commit adds a new launch target called "Pyright CLI (pyright-internal)" which bypasses webpack and just runs the package straight from the packages/pyright-internal/out directory where tsc has built it.
* fix outFiles directive
The VSCode docs say about outFiles:
> By default, VS Code will search your entire workspace, excluding node_modules, for sourcemaps. In large workspaces, this search might be slow. You can configure the locations where VS Code will search for source maps by setting the outFiles attribute in your launch.json.
I guess this is the right change to make? it didn't make any difference in VSCode debugger's ability to hit breakpoints, though.
---------
Co-authored-by: Eric Traut <eric@traut.com>
2024-02-25 15:26:06 -07:00
Eric Traut
f7e37d51b9
Added support for call-site return type inference for class and instance methods. This addresses https://github.com/microsoft/pylance-release/issues/5515 . ( #7335 )
2024-02-25 14:50:28 -07:00
Eric Traut
3232c25589
Added special-case handling for 'typing_extensions' module whose stubs are part of typeshed's stdlib stubs even though it is not part of stdlib. This addresses #7318 .
2024-02-24 05:13:20 -07:00
Eric Traut
22b94ae3c3
Fixed a bug that leads to incorrect type inference for a lambda when passed to a constructor in certain circumstances. This addresses #7326 .
2024-02-23 14:09:10 -07:00
Eric Traut
218ee2f82c
Fixed a bug that resulted in "reportUnnecessaryTypeIgnoreComment" diagnostics to be generated even if the source file was in the "ignore" list. This addresses #7325 .
2024-02-23 11:04:16 -07:00
Eric Traut
c8f1f082fc
Added support for concatenated strings used in a @deprecated
decorator. This addresses #7319 .
2024-02-23 08:09:20 -07:00
Eric Traut
2b36897227
Fixed a bug that resulted in a false negative when attempting to use TypedDict
or Protocol
as an upper bound when using PEP 695 syntax. This addresses #7317 .
2024-02-22 14:39:51 -07:00
Eric Traut
bcf694bd9c
Implemented provisional support for PEP 728 (support for extra items within TypedDicts). You must set enableExperimentalFeatures to true for now. This addresses #7232 . ( #7313 )
2024-02-21 15:33:28 -07:00
PylanceBot
e955fab18e
[PylanceBot] Pull Pylance with Pyright 1.1.351 ( #7298 )
...
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-20 10:58:51 -08:00
Eric Traut
bc2544c996
Published 1.1.351
2024-02-19 15:25:09 -07:00
Eric Traut
6078f3deea
Fixed build break.
2024-02-19 15:17:19 -07:00
Eric Traut
9265ebd4b0
Added check for the use of an implicit position-only parameter (one that starts with a double underscore) that is located after a non-position-only parameter. This addresses #7290 . ( #7297 )
2024-02-19 15:13:25 -07:00
Eric Traut
9af0c64c88
Fixed a bug that led to incorrect type evaluation for a call that targets a generic function that uses a default argument for one of the generic parameters. This addresses #7291 . ( #7296 )
2024-02-19 14:23:27 -07:00
Eric Traut
8cc8a75bf6
Fixed a bug that results in a false positive with the reportUnnecessaryCast
check if the second argument is a special form. This addresses #7294 .
2024-02-19 09:10:10 -07:00
Eric Traut
08d3f6d38c
Added provisional support for draft PEP 742 (TypeIs).
2024-02-19 01:03:55 -07:00
Eric Traut
1700e5451b
Updated typeshed stubs to the latest version.
2024-02-19 00:36:06 -07:00
Eric Traut
d34a84c1d2
Fixed bug that results in a false positive error when calling update
on a TypedDict with zero defined entries. This addresses #7289 .
2024-02-18 13:48:29 -07:00
Eric Traut
caab6bdd02
Fixed bug that results in a false positive error when assigning a tuple value that includes an unpacked TypeVarTuple to another tuple that also includes an unpacked TypeVarTuple. This addresses #7285 . ( #7287 )
2024-02-17 16:12:38 -07:00
Eric Traut
169443d5e5
Fixed a false positive reportUnknownArgumentType
error when assigning an empty list or dict expression to an index expression subscripted with a slice. This addresses #7278 . ( #7286 )
2024-02-17 15:15:11 -07:00
Eric Traut
ab2c824167
Changed behavior of CLI's --watch
mode. Previously, it reported diagnostic deltas when it detected a change, but it is more useful if it reports all remaining diagnostics even for files that it didn't reanalyze due to a file change. This addresses #7267 .
2024-02-17 14:46:36 -07:00
Eric Traut
853241c9b4
Added missing check for inappropriate use of an unpacked TypeVarTuple within a TypeAliasType type parameter list. This addresses #7284 .
2024-02-17 13:41:15 -07:00
Eric Traut
effa6a24cb
Fixed a bug in the type narrowing logic for class pattern matching that resulted in incorrect narrowing in the negative (fall-through) case. This addresses #7280 . ( #7283 )
2024-02-17 01:34:55 -07:00
Eric Traut
5d78e9eeba
Change the heuristic for determining whether a metaclass supports __or__
. In the case where the metaclass derives from Any or Unknown, pyright now assumes that it doesn't override __or__
. This addresses #7260 .
2024-02-15 17:49:04 -08:00
Eric Traut
fed85eca65
Fixed a bug that results in a false positive error when a enum.nonmember
value is assigned to a class-scoped variable with a type annotation in an Enum class. This addresses #7265 . ( #7266 )
2024-02-14 19:42:36 -08:00
Eric Traut
4b206e3068
Fixed a bug that results in a false positive error when a method defined within a named tuple is overridden by a subclass. This addresses #7256 . ( #7259 )
2024-02-13 21:07:09 -08:00
Eric Traut
2ff6efb6d1
Fixed a recent regression that results in a false positive error when an Enum
subclass overrides __new__
or __init__
and then a subclass of that class assigns tuple values when defining enum members. This addresses #7252 . ( #7253 )
2024-02-13 01:02:59 -08:00
Eric Traut
6149e25c43
Fixed bug that results in a false positive "no overload implementation" error if an overloaded function is passed through a decorator that uses a ParamSpec. This addresses #7221 . ( #7246 )
2024-02-12 00:39:52 -08:00
PylanceBot
b1bb82d8f1
[PylanceBot] Pull Pylance with Pyright 1.1.350 ( #7240 )
...
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-09 13:35:42 -08:00
Erik De Bonte
ca64a6ceeb
Restrict vscode-pyright document selector to file
and untitled
schemes ( #7231 )
2024-02-08 15:41:21 -08:00
PylanceBot
e9f1cc51fe
[PylanceBot] Pull Pylance with Pyright 1.1.350 ( #7219 )
...
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-06 16:38:59 -08:00
Eric Traut
df9aa7cb01
Published 1.1.350
2024-02-05 08:37:40 -08:00
Eric Traut
ae4bc87530
Improved misleading diagnostic message when attempting to call a special type form.
2024-02-04 16:22:44 -08:00
Eric Traut
626f6553ab
Added missing check for out-of-bound index accesses for named tuple instances. This addresses #7196 . ( #7207 )
2024-02-04 15:26:04 -08:00
Eric Traut
e2fab5397c
Added check for use of TypedDict
or NamedTuple
as second argument to isinstance
call, which isn't allowed. This addresses #7203 . ( #7206 )
2024-02-04 14:53:33 -08:00
Eric Traut
63f7e9e7bb
Added check for an attempt to delete a named tuple entry. This addresses #7197 . ( #7205 )
2024-02-04 13:19:20 -08:00
Eric Traut
87eb5c2b64
Updated typeshed stubs to the latest version.
2024-02-04 12:45:49 -08:00
Eric Traut
20c0423748
Added missing check for an attempt to override a field in a named tuple within a subclass. This addresses #7198 .
2024-02-03 22:37:44 -08:00
Eric Traut
fe00eaa8a4
Fixed bug in isinstance
type narrowing logic that leads to incorrect narrowed type when the filter type (the second argument) and the test type (the first argument) are both type variables. This addresses #7081 . ( #7194 )
2024-02-02 23:23:35 -08:00
Eric Traut
9e2136cb5a
Added code to deduplicate references returned by the textDocument/references LSP call. This addresses #7171 .
2024-02-02 23:02:28 -08:00
Eric Traut
9716d80fd1
Improved handling of unreachability analysis for an "implied else" (an if/elif chain that is missing a final "else" clause). This addresses #7189 . ( #7191 )
2024-02-02 16:54:17 -08:00
Eric Traut
7c060cb328
Another tweak to improve interruptions.
2024-02-02 12:58:09 -08:00
Eric Traut
e5f13bbad0
Fixed a bug that results in a false positive error when a TypeVar bound to a union of literals is used in the specialization of a TypeAlias whose TypeVar is bound to a wider union of literals. This addresses #7184 . ( #7187 )
2024-02-02 00:56:00 -08:00
Eric Traut
42d853f3d4
Fixed a bug that results in a false negative when a None
type is in… ( #7176 )
...
* Fixed a bug that results in a false negative when a `None` type is included in an unpacked argument within a function call. This addresses #7175 .
* Improved logic for unpacked arguments that contain an "Unbound" type.
2024-01-31 20:50:15 -08:00
Eric Traut
a81633d566
Fixed a bug that resulted in an incorrect type evaluation when a TypeVar with a default (PEP 696) was used in an overload but was not solved. This addresses #7173 . ( #7174 )
2024-01-31 16:59:53 -08:00
Rich Chiodo
e01b0fe205
Add test(s) that validate Pyright can talk over LSP ( #7172 )
...
* Everything building, but not running
* More tests passing
* Fix test to open a file
* Remove unused functions and consolidate others
* Remove unused custom lsp messages
* Add comments
2024-01-31 16:38:37 -08:00
Eric Traut
7585378936
Changed behavior of super()
method call when self
is annotated as a protocol class. This pattern is used for annotating mix-ins. In this case, pyright should not generate an error if the protocol's method isn't implemented. This addresses #7160 . ( #7168 )
2024-01-30 21:04:24 -08:00
seairth
12e9dd9c9b
Added multi-root workspaceFolder support in path variable expansion ( #7138 )
...
Co-authored-by: Seairth Jacobs <sjacobs@wrsystems.com>
2024-01-29 09:48:49 -08:00
Eric Traut
419ae4212f
Published 1.1.349
2024-01-28 23:38:14 -08:00
Eric Traut
6457531718
Fixed a bug that resulted in incorrect type narrowing for sequence patterns when the subject expression contains a tuple with an unbounded component. This addresses #7117 . ( #7156 )
2024-01-28 23:31:20 -08:00
Eric Traut
c8c8ceaed4
Fixed a bug that resulted in incorrect type evaluation when calling a tuple
constructor with bidirectional type inference and the value passed to the constructor is an Iterable[Any]
. This addresses #7085 . ( #7155 )
2024-01-28 21:14:11 -08:00
Eric Traut
7362545f98
Added additional performance enhancements specifically for large unions of literal types. This addresses #7143 . ( #7154 )
2024-01-28 18:07:14 -08:00
Eric Traut
31f09f3189
Added missing check for the use of Annotated
or a type alias defined with Annotated
as the second argument to an isinstance
or issubclass
call. This produces an exception at runtime. This addresses #7092 .
2024-01-28 13:59:42 -08:00
Eric Traut
509bf6985b
Fixed bug that resulted in incorrect type evaluation when a TypeAliasType is used in a value expression. This addresses #7109 .
2024-01-28 13:49:04 -08:00
Eric Traut
928d1cf68a
Fixed a bug that results in a false negative when the literal typing.Any
is passed to a function that accepts a type[T]
. Any
is a special form and should not be compatible with type
. This addresses #7082 . ( #7153 )
2024-01-28 13:37:41 -08:00
Eric Traut
1d4b1ccb39
Fixed bug in tuple type compatibility logic that resulted in a false negative when dest type includes an upacked unbounded tuple plus additional entries. This addresses #7115 . ( #7152 )
...
Fixed bug in tuple type compatibility logic that resulted in a false positive when dest type is `tuple[Any, ...]`. This addresses #7129 .
Improved error messages for tuple type mismatches that involve tuples with indeterminate types.
2024-01-28 13:02:46 -08:00
Eric Traut
725f91fb9c
Fixed a bug that results in a false positive when using a TypeVarTuple to capture the parameters of a generic callable that includes one or more default argument values. This addresses #7146 . ( #7150 )
2024-01-28 10:43:07 -08:00
Eric Traut
e18963f90e
Added support for enum member aliases defined within an enum class. This addresses #7142 . ( #7149 )
2024-01-28 10:23:40 -08:00
Eric Traut
c7d5fbdb5b
Added special-case logic to handle __name__
and a few other instanc… ( #7148 )
...
* Added special-case logic to handle `__name__` and a few other instance variables defined in the `type` class so they are treated specially when accessed from a class instance. This addresses #7145 .
* Fixed style issue.
2024-01-28 10:07:56 -08:00
Eric Traut
ee4e30cf70
Added missing check for inappropriate use of Final
in a value expression. This addresses #7094 .
2024-01-25 20:04:18 -08:00
Eric Traut
9c0c056b1f
Fixed regression that resulted in a false positive error when calling an abstract method on an abstract class that passes through the constraint solver (e.g. a generic decorator). This addresses #7105 . ( #7127 )
2024-01-25 19:25:46 -08:00
Eric Traut
df5d48c6e3
Fixed a bug that resulted in an incorrect type evaluation for a union type used as a runtime expression. The type should be UnionType
, not type[UnionType]
. ( #7121 )
2024-01-25 01:26:05 -08:00
Eric Traut
d94df3abec
Changed handling of tuple
with multiple unpacked embedded tuples. Type spec now clarifies this is OK as long as there are not multiple unbounded embedded tuples. This addresses #7114 . ( #7120 )
2024-01-25 00:44:20 -08:00
Eric Traut
dcc33ca58c
Changed the way pyright translates tuple[()]
into a specialized Sequence
. It used to translate it to Sequence[Any]
, but the typing spec now clarifies that it should be Sequence[Never]
. This addresses #7118 . ( #7119 )
2024-01-24 23:33:09 -08:00
Eric Traut
ebebb7fd3c
Removed name consistency match for functional form of Enum. After a discussion in the typing community, it was decided that name consistency checks in some cases were unnecessary and inappropriate for type checkers.
2024-01-24 16:43:03 -08:00
Eric Traut
cfb1de0cc4
Fixed default for reportImplicitStringConcatenation
in schema file.
2024-01-22 12:29:32 -08:00
Eric Traut
015e143247
Removed tests from typeshed stubs. We don't use these, so they're just taking up unnecessary space.
2024-01-21 17:05:31 -08:00
Eric Traut
a168f42a3e
Published 1.1.348
2024-01-21 09:50:43 -08:00
Eric Traut
197ecd7bc4
Added three new diagnostic rules: reportArgumentType
covers argument type compatibility checks, reportAssignmentType
covers type compatibility checks for assignments, and reportReturnType
covers type compatibility checks for return and yield statements. This partially addresses #6973 . ( #7077 )
2024-01-21 02:20:52 -08:00
Eric Traut
6ac1a7eebf
Added new diagnostic rule reportCallIssue
that covers issues relating to call expressions and arguments. This partially addresses #6973 . ( #7076 )
2024-01-21 01:47:43 -08:00
Eric Traut
63637459ca
Added two new diagnostic rules: reportAttributeAccessIssue
is related to attribute accesses and reportIndexIssue
is related to index operations and expressions. This partially addresses #6973 . ( #7075 )
2024-01-21 01:35:19 -08:00
Eric Traut
8270551bbe
Added two new diagnostic rules: reportAbstractUsage
reports invalid use of abstract classes and methods and reportOperatorIssue
covers diagnostics related to unary and binary operators. This partially addresses #6973 . ( #7074 )
2024-01-21 01:07:49 -08:00
Eric Traut
ec6052ea9d
Added two new diagnostic rules: reportInvalidTypeArguments
reports invalid type arg usage and reportRedeclaration
reports attempts to redeclare the type of a symbol. This partially addresses #6973 . ( #7073 )
2024-01-21 00:33:05 -08:00
Eric Traut
7a67f4fbdb
Added two new diagnostic rules: reportInconsistentOverload
reports inconsistencies between overload signatures and/or implementation and reportNoOverloadImplementation
reports an overloaded function with a missing implementation. This partially addresses #6973 . ( #7072 )
2024-01-21 00:04:55 -08:00
Eric Traut
91960fba49
Added new diagnostic rule reportPossiblyUnboundVariable
, which is split off from reportUnboundVariable
. This addresses #6896 . ( #7071 )
2024-01-20 23:34:11 -08:00
Eric Traut
aa64fc5dec
Added two new diagnostic rules: reportAssertTypeFailure
for type mismatches detected by typing.assert_type
and reportUnusedExcept
for situations where an except statement is determined to be unreachable. ( #7070 )
2024-01-20 22:21:42 -08:00
Eric Traut
04e0536a52
Added new diagnostic rule reportInvalidTypeForm
that controls reporting of invalid type expression forms. This partly addresses #6973 . ( #7069 )
2024-01-20 21:56:10 -08:00
Eric Traut
566f333ee1
Fixed a bug that led to a false negative when an illegal form of tuple was used: tuple[*tuple[str], ...]
. ( #7066 )
2024-01-20 18:35:53 -08:00
Eric Traut
3c36b308d2
Changed diagnostic rule for the case where Callable
is missing a second type argument. It should use reportMissingTypeArgument
.
2024-01-20 17:32:49 -08:00
Eric Traut
32f0685bb1
Modernized a few diagnostic messages to refer to tuple
(lowercase) rather than Tuple
(uppercase).
2024-01-20 17:32:16 -08:00
Eric Traut
578ec79ae4
Fixed a bug that resulted in a false positive error and incorrect type evaluation when an assignment expression (walrus operator) is used in a comprehension. This addresses #6992 . ( #7064 )
2024-01-20 14:55:25 -08:00
Eric Traut
301ee7df5f
Disabled debug check that was accidentally enabled several builds ago.
2024-01-20 14:36:29 -08:00
Eric Traut
d21168ee64
Updated typeshed stubs to the latest version.
2024-01-19 22:08:10 -08:00
Eric Traut
af44054edb
Fixed a bug that masked an error (false negative) under certain circumstances when evaluating a lambda. This addresses #7012 . ( #7059 )
2024-01-19 21:55:50 -08:00
Eric Traut
50f677c96d
Addressed a bug that led to a false positive (missing error) when a "bare" TypeVar is used as a base class in a class statement. This addresses #7023 . ( #7058 )
2024-01-19 20:34:01 -08:00
Eric Traut
335255fea2
Added error reporting for the situation where a generic instance vari… ( #7057 )
...
* Added error reporting for the situation where a generic instance variable is accessed through a class object. This addresses #7051 .
* Fixed style issue.
2024-01-19 17:41:53 -08:00
Eric Traut
f10455eb0b
Changed handling of tuple[Any, ...]
so it is treated as though it's bidirectionally type compatible with all tuples regardless of length. This addresses #7053 . ( #7054 )
2024-01-19 16:18:26 -08:00
PylanceBot
9ec6bebadb
pull-pylance-with-pyright- ( #7052 )
...
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: rchiodo <rchiodo@microsoft.com>
2024-01-19 16:05:58 -08:00
Eric Traut
0fc568260a
Improved handling of Annotated
and other special forms when they are used in runtime value expressions rather than annotations. This addresses #7049 . ( #7050 )
2024-01-19 09:40:37 -08:00
Eric Traut
01b1aa02a1
Added type enforcement for the _value_
type in an Enum class. Also added enforcement for custom __new__
and __init__
method signatures. This addresses #7030 and #7029 . ( #7044 )
2024-01-19 00:33:55 -08:00
Eric Traut
85e8de6397
Added special-case logic for enum classes that are invoked as though they are being constructed. This addresses #7027 . ( #7042 )
2024-01-18 20:26:01 -08:00