Eric Traut
364cb03065
Fixed a bug that resulted in an incorrect reporting of "unreachable code" after a call to a generator function that contains an unreachable yield statement. This addresses https://github.com/microsoft/pylance-release/issues/4041 .
2023-03-03 23:56:46 -07:00
Eric Traut
0a206e8841
Removed the need for the binder to understand typing.Required
and typing.NotRequired
special forms. This allows these forms to be imported, re-exported, and aliased.
2023-03-03 13:19:18 -07:00
Eric Traut
05371729ae
Removed some unused fields.
2023-03-03 08:01:03 -07:00
Eric Traut
f8ce7ca1fd
Made JSON parsing stricter for the pyrightconfig.json file. Previously, a JSON syntax error was not detected or reported. This addresses https://github.com/microsoft/pyright/issues/4722 .
2023-03-03 00:52:06 -07:00
Eric Traut
3035662636
If no files are found and no errors are detected but the --outputjson
command-line option is used, a json report should still be issued. This addresses https://github.com/microsoft/pyright/issues/4723 .
2023-03-03 00:24:06 -07:00
Eric Traut
659fdfab75
Improved handling of typing.TypeAlias
so it can be aliased and re-exported from other files. This addresses https://github.com/microsoft/pyright/issues/4197 .
2023-03-03 00:08:32 -07:00
Eric Traut
edfe2aa268
Improved error handling for dictionary expressions that use bidirectional type inference when the key type doesn't match the expected type.
2023-03-03 00:07:47 -07:00
Eric Traut
963d80b192
Fixed misspelled function name in completion provider. No functional change.
2023-03-02 14:25:56 -07:00
Eric Traut
7035c8361f
Made first steps toward moving Final and TypeAlias processing out of the binder. This is in support of https://github.com/microsoft/pyright/issues/4197 .
2023-03-02 13:21:08 -07:00
Eric Traut
81f21ee3d4
Added support for type guard patterns type(x) == T
and type(x) != T
. This addresses https://github.com/microsoft/pyright/issues/4719 .
2023-03-01 23:29:44 -07:00
Grace Petryk
ac3487e03f
Fix indented code blocks in docstrings ( #4717 )
...
* fix indented code blocks in docstrings
* require same indent level for closing tag
* nit: comments
* review: added test
* use tripleTick constant instead of escaping
* chore: prettier
---------
Co-authored-by: Eric Traut <eric@traut.com>
2023-03-01 23:29:14 -07:00
PylanceBot
93a4ef878d
[PylanceBot] Pull Pylance with Pyright 1.1.296 ( #4716 )
...
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>
2023-03-01 15:51:08 -08:00
Eric Traut
124334db92
Fixed a bug that caused the variance for type parameters to be incorrectly inferred when an auto-variance class derived from a non-auto-variance class. This addresses https://github.com/microsoft/pyright/issues/4713 .
2023-03-01 15:27:08 -07:00
Eric Traut
3c72a3733e
Performance optimization: reduced formatting of error messages in cases where it can be determined that they are not needed (e.g. in speculative evaluation code paths).
2023-03-01 14:40:01 -07:00
Michael Davis
7ef5bf86f0
Declare workspaceFolders support in server capabilities ( #4666 )
...
* Declare workspaceFolders support in server capabilities
The `vscode-languageserver-node` dependency will attempt dynamic
capability registration for workspace folder change notifications
if this `workspace.workspaceFolders.changeNotifications` is not set
in the `InitializeResult`. That is problematic for clients that don't
support dynamic capability registration: if we send a JSONRPC error,
the server will exit because of the rejected promise.
The server has support for workspace folders and requests and uses
change notifications as far as I can see, so I believe it's more
correct to declare support for these up-front anyways.
* Fix formatting
---------
Co-authored-by: Heejae Chang <1333179+heejaechang@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
2023-03-01 14:18:45 -07:00
Eric Traut
02b4c17b24
Added logic to detect when a type alias is used in a generic class declaration's base class list and a type parameter used with the type alias is incompatible with the variance required for the type alias. This addresses https://github.com/microsoft/pyright/issues/4699 .
2023-03-01 11:47:53 -07:00
Eric Traut
569b5dc730
Fixed a bug that resulted in a false negative when defining a generic class that derives from another generic class and the type parameter isn't compatible with the variance of the base class.
2023-03-01 11:46:17 -07:00
Eric Traut
2ce319c001
Implemented missing check for generic type alias specialization when too few type arguments are provided. This addresses https://github.com/microsoft/pyright/issues/4709 .
2023-03-01 10:13:02 -07:00
Eric Traut
e2f8a7376f
Fixed a recent regression that resulted in an incorrect type evaluation when using a __new__
method whose return type annotation is Self
. This addresses https://github.com/microsoft/pyright/issues/4705 .
2023-03-01 01:49:49 -07:00
Eric Traut
bea60409c1
Fixed a bug that led to a false positive error when using the |
operator with two dicts whose keys or values are defined as literals. This addresses part of https://github.com/microsoft/pyright/issues/4707 .
2023-03-01 01:30:50 -07:00
Eric Traut
c458d16aea
Added support for bidirectional type inference for dictionary expressions with dictionary expansion entries. This partially addresses https://github.com/microsoft/pyright/issues/4707 .
2023-02-28 23:05:40 -07:00
Eric Traut
55c917ab32
Extended logic that searches for site-packages
directory within a venv to handle the case where multiple /lib/python3.X/site-packages
are present. The new logic prefers the configured Python version rather than picking the first one returned by the file system. This addresses https://github.com/microsoft/pyright/issues/4708 .
2023-02-28 22:33:36 -07:00
Eric Traut
8c79c1bb5a
Published 1.1.296
2023-02-28 01:03:52 -07:00
Eric Traut
85c043dc32
Improved performance by not inferring return type of overloaded implementation when binding an overloaded method to an object.
2023-02-28 00:19:24 -07:00
ErezAmihud
2857963212
add gitlab ci documentation ( #4704 )
2023-02-27 13:57:05 -07:00
Bill Schnurr
9b0127cde3
added module name to moduleUnknownMember diagnostic to help inform wh… ( #4691 )
2023-02-27 11:12:58 -08:00
Eric Traut
712d560ca6
Added diagnostic check for when unknown or partially-unknown type is captured by a wildcard pattern in a match statement. This addresses https://github.com/microsoft/pyright/issues/4703 .
2023-02-27 09:14:12 -07:00
Marco Zatta
275006231d
Pedantic clarification on ALE support ( #4698 )
2023-02-27 08:28:33 -07:00
Eric Traut
526d907def
Slimmed down the README to remove information that most pyright users probably don't care about. Features of pyright were moved to a separate "features.md" document.
2023-02-26 10:54:20 -07:00
Eric Traut
90e70c3786
Updated typeshed stubs to the latest version.
2023-02-26 08:37:41 -07:00
Eric Traut
5e96c7bb73
Fixed bug that resulted in a false positive error with assert_type
when the evaluated type involved a pseudo-generic class. This addresses https://github.com/microsoft/pyright/issues/4694 .
2023-02-25 21:08:50 -07:00
Eric Traut
438ca5fef2
Changed logic to treat self
and cls
parameters as positional-only for purposes of protocol matching. This addresses https://github.com/microsoft/pyright/issues/4685 .
2023-02-25 11:19:24 -07:00
Eric Traut
30893e55cf
Consolidated some special-case logic for detecting implicit class methods. No functional change.
2023-02-25 09:22:57 -07:00
Eric Traut
d53ae966a8
Fixed bug that caused a false positive when a variable of type type
is used as an argument to a class declaration. This addresses https://github.com/microsoft/pyright/issues/4690 .
2023-02-24 19:34:11 -07:00
Erik De Bonte
dbda7d41a1
Actions to publish to VS Code Marketplace ( #4676 )
2023-02-24 13:53:01 -08:00
Eric Traut
a9f299c8ce
Enhanced the reportUnnecessaryComparison
to check for unused patterns in a match
statement. This addresses https://github.com/microsoft/pyright/issues/4689 .
2023-02-24 12:23:33 -07:00
Eric Traut
d424fdfe50
Improved support for ternary expressions that use a statically-evaluatable condition expression. This addresses https://github.com/microsoft/pyright/issues/4688 .
2023-02-24 10:42:01 -07:00
PylanceBot
773a7cde20
pull-pylance-with-pyright-1.1.295 ( #4682 )
2023-02-23 15:56:08 -08:00
Eric Traut
b7e3004f98
Addressed a performance issue that resulted in long evaluation times when a variable was used in a loop but was not initialized prior to the loop. This addresses https://github.com/microsoft/pyright/issues/4588 .
2023-02-23 15:19:15 -07:00
Eric Traut
31ba5a7f05
Fixed a bug that resulted in incorrect type evaluation of augmented assignments used in loops in some cases.
2023-02-23 15:17:53 -07:00
Eric Traut
062aadc0df
Fixed regression in import resolver that resulted in spurious "stub not found" diagnostics.
2023-02-23 10:07:20 -07:00
Eric Traut
19d440b91f
Fixed a bad comment.
2023-02-23 08:57:53 -07:00
Eric Traut
1ae69d2d0b
Improved type inference of method calls on super()
so Self
is generated rather than the concrete class. This addresses https://github.com/microsoft/pyright/issues/4670 .
2023-02-22 15:42:58 -07:00
Eric Traut
ae13a42645
Fixed a bug that resulted in a false positive when determining the correct variance of a TypeVar used within a class. This addresses https://github.com/microsoft/pyright/issues/4674 .
2023-02-22 15:21:30 -07:00
PylanceBot
e411e53e85
[PylanceBot] Pull Pylance with Pyright 1.1.295 ( #4675 )
...
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>
2023-02-22 10:01:56 -08:00
Eric Traut
f5e43ca29f
Published 1.1.295
2023-02-22 01:03:48 -07:00
Eric Traut
f4aae1a98f
Fixed bug that resulted in incorrect type evaluation when a __new__
is called and is bound to a class that is different from the cls
argument passed to it. This addresses https://github.com/microsoft/pyright/issues/4668 .
2023-02-22 01:01:40 -07:00
Declan Brady
28ef5bcbf0
Added parameter documentation on hover from function docString ( #4655 )
...
* Added parameter documentation on hover from function docString
* Added test cases for hover, cleaned up nits
* Added edge case test for parameter symbol reassignment
* Ran prettier
---------
Co-authored-by: Rich Chiodo <rchiodo@users.noreply.github.com>
2023-02-21 15:07:58 -08:00
Eric Traut
6017cdad5e
Updated typeshed stubs to the latest.
2023-02-21 01:14:08 -07:00
Eric Traut
8024a16ed0
Fixed test case that was broken by changes in typeshed definition of object.__class__
.
2023-02-21 01:11:09 -07:00