Eric Traut
1af4b93ba3
Fixed bug that results in incorrect type narrowing on assignment if the narrowed type is Self
or another bound type variable. This addresses #9147 . ( #9154 )
2024-10-05 20:45:46 -07:00
Eric Traut
8ed69a9b41
Removed provisional support for [PEP 746]( https://discuss.python.org/t/pep-746-typedmetadata-for-type-checking-of-pep-593-annotated/53834 ) because the PEP has been modified, and there is disagreement about the best approach.
2024-10-05 10:54:45 -07:00
Eric Traut
bbab701301
Added limiter to sequence pattern matching logic to prevent a combinatoric explosion when performing tuple expansion during narrowing. This addresses #9149 . ( #9150 )
2024-10-04 11:54:13 -07:00
Eric Traut
cd5f5d38a1
Enhanced isinstance
narrowing logic to retain type arguments in cases where the filter type (the second argument) is a child of the un-narrowed type and the child has a type parameter that is used multiple times in its base class (e.g. Child[T](Parent[T, T])
). This addresses #9141 . ( #9144 )
2024-10-03 13:33:51 -07:00
Eric Traut
3b8ffed865
Fixed bug that results in a false negative under certain circumstances when using PEP 695 syntax and a TypeVarTuple multiple times in a signature.
2024-10-02 14:21:54 -07:00
Eric Traut
b3bb9776f1
Fixed bug that results in a false positive when Union
and Unpack
are used outside of a type expression. Normal type expression rules should not be applied in this case. This addresses #7416 . ( #9135 )
2024-10-02 13:04:44 -07:00
Eric Traut
39a5a201be
Added OmitTypeVarScopes flag to typePrinter. It's not currently used, but we're considering switching to this.
2024-10-02 11:26:43 -07:00
Eric Traut
03eda6ed7a
Refactored some code in the type evaluator to handle Unpack
and *
operators in type annotations in a common manner.
2024-10-02 11:24:05 -07:00
Bill Schnurr
243983220e
pull-pylance-with-pyright-1.1.383 ( #9133 )
2024-10-02 06:53:06 -07:00
Eric Traut
5e57e0a3a5
Published 1.1.383
2024-10-01 15:39:50 -07:00
Eric Traut
606e12e815
Fixed bug that caused type alias to Never
or NoReturn
to lose its type alias association in some circumstances. ( #9127 )
2024-10-01 13:55:47 -07:00
Eric Traut
c2364e4281
Fixed bug that results in a false negative when a type variable is defined with the expression ...
. This should be flagged as an illegal type expression. This addresses #9120 . ( #9123 )
2024-10-01 09:09:16 -07:00
Eric Traut
67a3d24e51
Fixed a performance regression caused by a recent bug fix that affects variance inference for recursive type aliases. This addresses #9118 . ( #9119 )
2024-09-30 22:01:34 -07:00
Eric Traut
93260969ff
Fixed several bugs related to the explicit specialization of a generic type alias parameterized by a single ParamSpec. Concatenate
was being handled incorrectly. This addresses #9088 . ( #9117 )
2024-09-30 21:20:19 -07:00
Eric Traut
0b02230dde
Improved type evaluation performance in certain cases involving protocol matching for complex, nested protocols. This addresses #9109 . ( #9115 )
2024-09-30 14:30:09 -07:00
Eric Traut
6b19e98d26
Renamed internal symbol for readability and improved some comments. No functional change.
2024-09-30 13:10:26 -07:00
Eric Traut
3fcce1b8bb
Refactored code to eliminate some circular dependencies that have crept into some of the type evaluator modules. No functional change.
2024-09-29 17:32:33 -07:00
Eric Traut
7309394e6e
Fixed bug that resulted in a false negative when assigning a specialized recursive generic type alias to itself when variance of its type parameters are not covariant. This addresses #9081 . ( #9103 )
2024-09-27 21:36:55 -07:00
Eric Traut
61767ff247
Fixed bug that results in incorrect variance inference for some generic type aliases that use auto variance and nested callable types. ( #9102 )
...
Added the ability to view inferred variance for type aliases created with a `type` statement by hovering over the type parameter declaration.
This partly addresses #9081 .
2024-09-27 19:56:28 -07:00
Eric Traut
37363e1c97
Reduced the minimum time between analysis passes from 20ms to 5ms to improve startup performance.
2024-09-27 17:20:00 -07:00
Eric Traut
4074d881a9
Added "skipNativeLibraries" config option for environments that are guaranteed not to have native libraries (e.g. web-based environments or playgrounds).
2024-09-27 17:19:25 -07:00
Eric Traut
aee8a18744
Fixed incorrect logging message for execution environment "name" field.
2024-09-27 17:18:18 -07:00
Eric Traut
6c5787c899
More tweaks to logging for execution environments.
2024-09-27 16:42:49 -07:00
Eric Traut
a485ccc833
Added check for use of a TypedDict class within a case
statement class pattern. This condition generates a runtime error. This addresses #9078 .
2024-09-27 11:47:03 -07:00
Eric Traut
bdbb396355
Added code to propagate information about certain typing module imports from an implicitly-imported module (e.g. builtins
or __builtins__.pyi
) so Final
and ClassVar
can be treated as special forms by the binder. This fixes the use of these typing symbols in notebooks within pylance, which leverages implicitly-imported modules to "chain together" notebook cells. This addresses #6455 .
2024-09-27 10:35:28 -07:00
Eric Traut
3e339eb4ba
Fixed bug with the provisional TypeForm
support that breaks aliases of Annotated
. This addresses #9092 . ( #9095 )
2024-09-26 12:38:51 -07:00
Eric Traut
cdcf40d506
Fixed a bug that leads to incorrect type evaluation when "literal math" for unary operators are applied to a TypeVar value that has a literal value upper bound. This addresses #9090 . ( #9094 )
2024-09-26 11:36:15 -07:00
Stella
e46efc6b58
Pull Pylance with Pyright 1.1.382 ( #9077 )
...
* Push pylance changes to pyright
* Update jest.config.js
2024-09-26 11:07:19 -07:00
Eric Traut
da667e68d4
Improved verbose logging of execution environment information.
2024-09-26 10:09:57 -07:00
Eric Traut
6605ffca61
Fixed style issue.
2024-09-26 08:22:45 -07:00
Juan Torrente
d0cabb74da
Counting files seen ( #9087 )
...
Adds a counter for number of files seen. Only shows "too many files" error message if bigger than a given number (hardcoded to 50 same as number of seconds is hardcoded to 10).
This avoids throwing the error suggesting opening a subfolder when the long operation time for directory reading is actually due to the number of files being read (as opposed to very large, very few files).
2024-09-26 08:08:41 -07:00
Eric Traut
d2bd07bf6e
Fixed a bug that resulted in an incorrect error when using a # pyright: standard
directive. This addresses #9085 .
2024-09-25 22:56:28 -07:00
Eric Traut
553222b529
Improved logging for execution environment settings. Previously, only the import search paths were logged. Now the python version and python platform are also logged.
2024-09-25 16:37:36 -07:00
Eric Traut
b14a0db666
Made a change to speed up initial analysis when language server is first launched. Previously, a backoff timer of 250ms (which is intended only for user interactions) applied to startup.
2024-09-25 16:16:27 -07:00
Eric Traut
a209885f0d
Published 1.1.382
2024-09-24 17:40:55 -07:00
Eric Traut
399d57d395
Fixed a bug that results in incorrect type evaluation behaviors when a class has a custom metaclass with a __call__
method and a __new__
or __init__
method that provides a different bidirectional type inference context for parameters. This addresses #9067 . ( #9071 )
2024-09-24 15:16:56 -07:00
Eric Traut
ef263af523
Extended reportUnnecessaryComparison
to cover more cases involving is
and is not
operators. This addresses #9068 . ( #9070 )
2024-09-24 12:27:08 -07:00
Eric Traut
6d66b90553
Fixed a bug that can result in a false positive error when a function signature contains a positional-only parameter and a keyword parameter with the same name. This can result from the application of a ParamSpec or through the use of an unpacked TypedDict. This addresses #9043 and #8964 . ( #9064 )
2024-09-23 12:54:00 -07:00
Eric Traut
3a854fd445
Fixed bug that results in incorrect type narrowing when a value typed as TypeForm
is used as the first argument to isinstance
. This addresses #9053 .
2024-09-23 10:22:02 -07:00
Eric Traut
fb8cf71da5
Added check for the illegal use of TypeForm
as the second argument to an isinstance
or issubclass
call.
2024-09-23 10:21:12 -07:00
Eric Traut
88bba999a9
Updated typeshed stubs to the latest version.
2024-09-23 08:32:54 -07:00
Eric Traut
06878da845
Fixed a bug that results in a false positive when assigning Never
to a type variable in a contravariant context. This addresses #9056 . ( #9061 )
2024-09-23 08:27:16 -07:00
Eric Traut
136bf0ef6b
Fixed bug that resulted in a "reportIncompatibleMethodOverride" error being reported in the wrong location when a property method has a decorator applied to it. This addresses #9059 . ( #9060 )
2024-09-22 23:07:18 -07:00
Eric Traut
ed4d23e784
Fixed bug that results in a false negative when assigning a value to a union type that includes the same type variable multiple times in at least one invariant context. This change eliminates the concept of a "locked" constraint tracker, which is no longer needed and was the underlying cause of the bug. This addresses #9047 . ( #9048 )
2024-09-21 13:50:06 -07:00
Eric Traut
32a5ac5d2a
Small code cleanup: use ParseTreeUtils.isWithinAssertExpression for isinstance check rather than inlining the logic to detect an assert expression. No functional change.
2024-09-21 11:55:22 -07:00
Eric Traut
e0d33e4808
Fixed bug that results in false positive error when using a Final
variable in a protocol and a NamedTuple or frozen dataclass as a concrete class. This addresses #9040 .
2024-09-20 09:59:17 -07:00
Eric Traut
1a174766db
Improved hover text for converters in dataclass-like classes. This addresses #9041 .
2024-09-20 09:10:28 -07:00
Eric Traut
239749351d
Fixed bug that results in incorrect type inference for list, set, dict, and tuple expressions that include modules in them. This addresses #9036 . ( #9038 )
2024-09-19 09:38:08 -07:00
Eric Traut
2b4563f535
Added special-case handling for the len(t) == L
type guard pattern to handle the negative narrowing case where tuple t
has a minimum length of L
. In this case, the narrowed type can be computed whereas previously it was left unnarrowed. This addresses #9031 . ( #9034 )
2024-09-18 12:30:06 -07:00
Stella
d0411a0abc
Push pylance changes to pyright ( #9033 )
2024-09-18 10:23:51 -07:00