Skip to content

DO NOT MERGE: Sync changes from upstream main branch #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 528 commits into
base: scip
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
528 commits
Select commit Hold shift + click to select a range
7ffe61a
Improved the protocol matching logic so it honors partially-solved ty…
erictraut Jun 12, 2023
d20a39c
Typeshed update 2 (#5274)
erictraut Jun 12, 2023
76f2dd1
Fixed a bug that led to infinite analysis time and heap exhaustion wh…
erictraut Jun 12, 2023
810f37f
Fixed a bug that led to a false positive `reportIncompatibleMethodOve…
erictraut Jun 12, 2023
b0c108f
Updated issue templates.
msfterictraut Jun 12, 2023
f7b3a1d
Fixed a regression that caused an incorrect type evaluation of a func…
erictraut Jun 13, 2023
0b49479
Published 1.1.314
msfterictraut Jun 14, 2023
ae795f5
pull-pylance-with-pyright-1.1.314 (#5293)
PylanceBot Jun 14, 2023
4d27f86
Fixed a regression that caused a false positive `reportMissingTypeArg…
erictraut Jun 14, 2023
7bfe315
Modified protocol matching and the constraint solver to handle an edg…
erictraut Jun 14, 2023
b0c4716
Fixed a bug that leads to a false positive error in the `reportIncomp…
erictraut Jun 14, 2023
6de44b9
Changed mypy_primer PR script to use 2 shards (parallel action execut…
msfterictraut Jun 15, 2023
f97ca05
Fixed a bug in type evaluation of the two-argument form of the `super…
erictraut Jun 15, 2023
d1c482b
Fixed bug that led to false positive errors when (#5305)
erictraut Jun 15, 2023
b12ca05
Clarification of --version argument usage string (#5308)
rjdbcm Jun 15, 2023
5c725bc
Fixed a bug that led to a false positive when passing unpacked lists …
msfterictraut Jun 15, 2023
20ce604
Changed parameter type inference logic to avoid inferring the type of…
msfterictraut Jun 15, 2023
450f71b
Fixed a regression that caused an incorrect type evaluation of a func…
msfterictraut Jun 15, 2023
8d9910e
Added more details about difference between mypy and pyright overload…
msfterictraut Jun 15, 2023
8a09073
Fixed a false negative where an unpacked dictionary argument was not …
erictraut Jun 15, 2023
2cd0220
Fixed several subtle bugs in the overload matching algorithm in the c…
erictraut Jun 16, 2023
b90abab
Improved the heuristic used to determine which subtypes of a union wi…
erictraut Jun 16, 2023
2829429
Fixed bug that led to an incorrect type evaluation for nested call ex…
erictraut Jun 17, 2023
0559382
Fixed false negative when a literal and non-literal are assigned to t…
erictraut Jun 17, 2023
327ce37
Added test case for https://github.com/microsoft/pyright/issues/5027.
msfterictraut Jun 18, 2023
3021b9c
Minor code cleanup — removed dead code and converted lambda to functi…
msfterictraut Jun 18, 2023
47cd514
Changed auto-variance algorithm to ignore `__new__` and `__init__` me…
erictraut Jun 18, 2023
9bf8231
Fixed a bug that led to incorrect type evaluation when passing a gene…
erictraut Jun 18, 2023
53cb3f9
Improved consistency of parameter ordering internally to type evaluat…
msfterictraut Jun 18, 2023
7ea11a1
Minor code cleanup — rename constant for clarity and refactor validat…
msfterictraut Jun 18, 2023
42a37f4
Re-enabled a test case that was previously disabled because it was br…
msfterictraut Jun 18, 2023
2de35e3
Added documentation about higher-order functions.
msfterictraut Jun 18, 2023
02b7769
Fixed a false positive error arising from the use of a binary express…
erictraut Jun 18, 2023
2b0f8d2
Improved hover text to display the calculated variance for a PEP 695-…
msfterictraut Jun 18, 2023
e3080b1
Fixed a bug that led to a false positive error under certain circumst…
erictraut Jun 18, 2023
52c8cac
Changed type printer (the component that renders types into text) to …
msfterictraut Jun 18, 2023
8ce23eb
Improved `reportUnnecessaryCast` so it works with types other than cl…
erictraut Jun 18, 2023
643bb1d
Improved type inference for lambdas in the case where a parameter inc…
erictraut Jun 18, 2023
056415f
Fixed a bug in the control flow debugging code that prints the contro…
msfterictraut Jun 18, 2023
23bcbce
Fixed bug in code flow engine that led to incorrect type evaluation o…
msfterictraut Jun 19, 2023
d816d00
Started to do a pass over the test cases to make them more consistent.
msfterictraut Jun 19, 2023
b7df200
Fixed bug that resulted in a false positive error when defining a new…
msfterictraut Jun 19, 2023
96e03aa
Did a cleanup pass for the dataclass test cases. Renamed and reordere…
msfterictraut Jun 19, 2023
67394ad
Continued cleanup of test cases.
msfterictraut Jun 19, 2023
1111f1b
Started to untangle the hairball related to the "genericTypesX.py" te…
msfterictraut Jun 19, 2023
899799d
Finished cleaning up "genericTypesX.py" test files.
msfterictraut Jun 19, 2023
0c5c7b6
Next batch of text case cleanup.
msfterictraut Jun 19, 2023
cd257f7
Next batch of test case cleanup.
msfterictraut Jun 19, 2023
5568b4d
Enhanced command-line version of pyright to allow file or directory n…
msfterictraut Jun 20, 2023
efea9b9
Changed behavior of non-ClassVar variables within a protocol definiti…
msfterictraut Jun 20, 2023
b0d4080
Next batch of test case cleanup.
msfterictraut Jun 20, 2023
43c5fae
Finished cleanup of test cases.
msfterictraut Jun 20, 2023
eff69f5
Fixed a bug that caused incorrect type inference for parameters in un…
msfterictraut Jun 20, 2023
d12ad6e
Updated typeshed stubs to the latest version.
msfterictraut Jun 20, 2023
9cbe8c0
Fixed a bug that caused an incorrect false positive error for an `ass…
erictraut Jun 20, 2023
63f5658
Support PEP 712's new attribute assignment conversion (#5343)
debonte Jun 20, 2023
ca8322f
Fixed a bug in type caching mechanism that could have resulted in poo…
msfterictraut Jun 20, 2023
521d84e
Added low-level caching mechanism for converting between instance and…
msfterictraut Jun 20, 2023
37535a3
Fixed a bug that led to incorrect type narrowing for the `isinstance`…
erictraut Jun 21, 2023
ed73c0e
Enhanced the `isinstance` type narrowing logic so it filters types ba…
erictraut Jun 21, 2023
cef2712
Published 1.1.315
msfterictraut Jun 21, 2023
d4fd3af
Fixed a bug in the new `-` command-line feature. This addresses https…
msfterictraut Jun 21, 2023
7b242d5
Added mitigation for reported assertion failure (and crash). This tem…
msfterictraut Jun 21, 2023
df7d83c
Fixed another instance of a false positive `reportMissingTypeArgument…
msfterictraut Jun 21, 2023
3f84540
pull-pylance-with-pyright-1.1.315 (#5359)
PylanceBot Jun 21, 2023
fb62cc9
Added support for bidirectional type inference when using a dictionar…
erictraut Jun 21, 2023
b3c77ba
Fixed bug that resulted in incorrect type evaluation when a generic c…
erictraut Jun 21, 2023
24e7550
Fixed formatting in test case. No functional change.
msfterictraut Jun 21, 2023
7fb28a4
Fixed a bug that resulted in a false positive when passing a class to…
erictraut Jun 22, 2023
ea96b47
Modified the signature of the synthesized `get` method for TypedDict …
erictraut Jun 22, 2023
241cd62
Removed some unnecessary code in the code path that validates generic…
msfterictraut Jun 23, 2023
c8a25b2
Revert "Added mitigation for reported assertion failure (and crash). …
msfterictraut Jun 23, 2023
1340dfa
Added proper fix for regression that caused crash within certain doub…
msfterictraut Jun 23, 2023
fbdfb52
Removed some unnecessary code in the code path for comparing generic …
msfterictraut Jun 23, 2023
a74a503
Fixed a bug that results in a false positive error when attempting to…
erictraut Jun 23, 2023
367b603
Renamed a few internal functions for consistency.
msfterictraut Jun 23, 2023
195b44e
Moved decorator functionality out of type evaluator into its own module.
msfterictraut Jun 23, 2023
9444c01
Fixed typo in comment.
msfterictraut Jun 23, 2023
9c01bf0
Added a small optimization to code path that assigns classes with typ…
msfterictraut Jun 24, 2023
c286eec
Cleaned up some generator test cases.
msfterictraut Jun 25, 2023
ec761d5
Added `isGenerator` field to ListComprehensionNode. It's not currentl…
msfterictraut Jun 25, 2023
d689dad
Moved the evaluation of the first iterator in a comprehension express…
erictraut Jun 25, 2023
ca370ef
Fixed a bug that led to a false negative when a generic class with ca…
erictraut Jun 25, 2023
67fe932
Published 1.1.316
msfterictraut Jun 26, 2023
85c840c
Fixed a regression that caused a false positive when comparing type c…
msfterictraut Jun 26, 2023
4527c5b
Changed '-' command-line feature to support multi-line input.
msfterictraut Jun 26, 2023
74d8f3c
pull-pylance-with-pyright-1.1.316 (#5401)
PylanceBot Jun 28, 2023
c767228
Improved documentation for "implied else" type narrowing.
msfterictraut Jun 28, 2023
0a67c65
Clarified in documentation that `no_type_check` is not supported.
msfterictraut Jun 30, 2023
c41bc9c
Fixed regression where console output was emitted during tests, pollu…
msfterictraut Jul 8, 2023
6bae226
Added special-case support for enum fields that are assigned using an…
erictraut Jul 11, 2023
e1063f1
Issue5453 5454 (#5461)
erictraut Jul 11, 2023
1c6cd1c
Extended support for TypedDict discrimination by literal field so it …
erictraut Jul 11, 2023
c2094c0
Fixed a bug that resulted in incorrect hover results for identifiers …
erictraut Jul 11, 2023
af48e92
Fixed recent regression in the synthesized TypedDict `get` method, wh…
erictraut Jul 11, 2023
9791786
Removed limitation that files specified on the command line or in "in…
erictraut Jul 11, 2023
bc89399
Fixed a bug that results in incorrect type evaluation for a higher-or…
erictraut Jul 11, 2023
72491ca
Modified diagnostic checks for list, dictionary, and tuple literal ex…
erictraut Jul 11, 2023
f9796dd
Fixed bug that led to a confusing hover type for the return result of…
erictraut Jul 11, 2023
8b38b5d
Added support for deferred annotation evaluation for `Annotated` type…
erictraut Jul 11, 2023
ada1ea6
Issue5405 5406 (#5470)
erictraut Jul 11, 2023
70ecdc2
Improved protocol type cache for improved type analysis performance i…
erictraut Jul 12, 2023
e63f229
Added detection of errors when a namedtuple definition includes a lan…
erictraut Jul 12, 2023
6ec6e74
Updated typeshed stubs to the latest version.
msfterictraut Jul 12, 2023
2eee955
Published 1.1.317
msfterictraut Jul 12, 2023
75b33af
Bump semver from 5.7.1 to 5.7.2 in /packages/vscode-pyright (#5484)
dependabot[bot] Jul 12, 2023
752b24a
Refactored "cast" call into its own function for readability. No func…
msfterictraut Jul 13, 2023
1fa0a4f
Added code to handle pathological case in unannotated code that write…
erictraut Jul 13, 2023
bb60966
Fixed a recent regression that resulted in unsolved type arguments wh…
erictraut Jul 13, 2023
6236155
Fixed a bug in type narrowing for pattern matching in the negative (f…
erictraut Jul 14, 2023
844256c
Added additional special-case handling for `__init_subclass__` and `_…
msfterictraut Jul 14, 2023
3efc3f2
Match CPython's __hash__ overriding behavior when __eq__ exists (#5501)
TheTripleV Jul 14, 2023
6a15a6d
Minor code cleanup for consistency.
msfterictraut Jul 14, 2023
b865a45
Add capability for Pylance to override strings (#5497)
rchiodo Jul 14, 2023
8e021d2
[PylanceBot] Pull Pylance with Pyright 1.1.317 (#5505)
PylanceBot Jul 14, 2023
bf15856
Eliminated the need to apply narrowing twice when evaluating the type…
msfterictraut Jul 15, 2023
01f40f0
Fixed bugs that resulted in incorrect or incomplete types when narrow…
erictraut Jul 15, 2023
92f4e6b
Modified `is None` type guard logic to eliminate `Any` or `Unknown` i…
erictraut Jul 15, 2023
132e7ed
Fixed bug that resulted in a false positive `reportOverlappingOverloa…
erictraut Jul 15, 2023
2a09686
Reverted the change for #5446 because it's causing false positive err…
msfterictraut Jul 15, 2023
cc92429
Add fsevents as optional dependency to public package (#5503)
adampauls Jul 16, 2023
88bff7e
Added fsevents to lock file.
msfterictraut Jul 16, 2023
bfe2128
Improved the error message for incompatible type arguments. Many user…
msfterictraut Jul 16, 2023
7fcdc92
Fixed a bug that resulted in a false negative when assigning a `T | N…
erictraut Jul 17, 2023
8e8b6c3
Fixed recent regression that resulted in a false positive error when …
erictraut Jul 17, 2023
6169e0f
Improved checks for illegal use of a variable within a type expressio…
erictraut Jul 17, 2023
6a25a7b
Removed the requirement that a `TypedDict` be marked `@final` for it …
msfterictraut Jul 17, 2023
77dd71f
Updated typeshed stubs to the latest version.
msfterictraut Jul 17, 2023
6311bfb
Fixed bug that caused an error to go undetected when the LHS of a cal…
msfterictraut Jul 17, 2023
7924640
Refactored logic to break up the validateCallArguments function in th…
msfterictraut Jul 17, 2023
dc81eff
Fixed a bug that resulted in incorrect evaluation of a type alias def…
erictraut Jul 18, 2023
5be5852
Further refactored the internal implementation of `validateCallArgume…
erictraut Jul 18, 2023
d7b0a85
Fixed a bug that resulted in a false positive when an expression of t…
erictraut Jul 18, 2023
9855dc9
Bump word-wrap from 1.2.3 to 1.2.4 (#5533)
dependabot[bot] Jul 18, 2023
5569939
Fixed a bug that led to a false negative when determining type compat…
erictraut Jul 18, 2023
ed295dd
Fixed bug that resulted in the incorrect variance inference of an "au…
msfterictraut Jul 19, 2023
c34857f
Fixed regression in recent (unpublished) change.
msfterictraut Jul 19, 2023
1d558e0
Published 1.1.318
msfterictraut Jul 19, 2023
b953f79
Fixed a bug that results in a crash when attempting to use a member a…
msfterictraut Jul 19, 2023
3126671
Fixed a bug that led to a false negative when analyzing code with an …
msfterictraut Jul 19, 2023
455830e
Improved error messages for situations where a call expression target…
erictraut Jul 19, 2023
b917b7a
Push pylance changes to pyright (#5542)
debonte Jul 19, 2023
98fcba1
Added support for the `X is C` and `X is not C` type guard pattern (w…
erictraut Jul 20, 2023
9aa29e4
Fixed an issue in type evaluation of call expressions where the calla…
erictraut Jul 20, 2023
97160a0
Fixed bug in hover text where it was not producing the correct text o…
msfterictraut Jul 20, 2023
c6e0f56
Added detection and reporting of illegal use of `type[Callable]` with…
erictraut Jul 20, 2023
a65b45e
Fixed a bug that resulted in a false positive error when bidirectiona…
msfterictraut Jul 20, 2023
19194dd
Fixed an inconsistency in reporting of unbound variables when the var…
erictraut Jul 21, 2023
39e355d
Fixed a bug that led to a false positive when a constrained type vari…
erictraut Jul 21, 2023
bf1ebd6
Improved robustness of handling of circular dependencies for class ev…
erictraut Jul 21, 2023
5162e0f
Enhanced support for `functools.partial` so it supports classes (cons…
msfterictraut Jul 21, 2023
6e3404a
Improved comment for createCallableType. No functional change.
msfterictraut Jul 21, 2023
37f8149
Fixed formatting of test case. No functional change.
msfterictraut Jul 21, 2023
2b420cf
Removed fragile hack that was previously added to handle type var sco…
erictraut Jul 21, 2023
b11e16c
Fixed a bug that led to a false positive error when using bidirection…
erictraut Jul 22, 2023
99dfe98
Added documentation about overloads and ParamSpec.
msfterictraut Jul 22, 2023
a40ed76
Simplified the bug and feature request templates and fixed a few typo…
msfterictraut Jul 22, 2023
a34eb58
Added section on plugins to the comparison with mypy.
msfterictraut Jul 22, 2023
914863e
Updated typeshed stubs to the latest version. (#5563)
erictraut Jul 22, 2023
c925ea5
Fixed a bug that led to a hang and eventual crash (due to memory exha…
erictraut Jul 22, 2023
deab693
Modified the heuristics used for narrowing on assignment when the ass…
erictraut Jul 23, 2023
ff61d75
Added support within the constraint solver for higher-order functions…
erictraut Jul 23, 2023
e8250ba
Fixed a bug that resulted in the incorrect inferred variance for a ty…
msfterictraut Jul 23, 2023
12e9c31
Fixed a theoretical bug in the code that detects unique type signatur…
msfterictraut Jul 25, 2023
1da8c18
Added support for type narrowing of a class pattern when the specifie…
erictraut Jul 25, 2023
98a6792
Published 1.1.319
msfterictraut Jul 26, 2023
932e542
pull-pylance-with-pyright-1.1.319 (#5584)
PylanceBot Jul 26, 2023
9fd63fe
Fixed small typo in documentation.
msfterictraut Jul 27, 2023
0265e65
Reverted version of `chalk` library. The newer version is not compati…
msfterictraut Jul 27, 2023
54b3591
Fixed a bug that resulted in a false positive error when attempting t…
erictraut Jul 27, 2023
d81ffb7
Added a new configuration options flag called `enableExperimentalFeat…
msfterictraut Jul 29, 2023
9a5af79
Removed support for experimental `StrictTypeGuard` and replaced it wi…
erictraut Jul 29, 2023
e82f5df
Fixed a bug that led to incorrect variance inference when a value ann…
msfterictraut Jul 29, 2023
394ad8d
Updated heuristics for how to handle custom metaclass `__call__` meth…
erictraut Jul 29, 2023
10b7fd3
Changed auto-variance algorithm to exempt class and instance variable…
msfterictraut Jul 29, 2023
d22b655
Fixed a regression that caused class decorators of generic classes to…
erictraut Jul 29, 2023
7df17e1
Fixed a bug that resulted in an apparent hang within the type printin…
msfterictraut Jul 29, 2023
a5b5b70
Removed old and misleading comment in a test case. No functional change.
msfterictraut Jul 29, 2023
5016812
Modified type inference logic so methods that raise an exception whos…
erictraut Jul 30, 2023
3f7c202
Documented the difference between mypy's and pyright's handling of `N…
msfterictraut Jul 30, 2023
cd156e7
Removed old code that looks for a `typeshed` override in the standard…
msfterictraut Jul 31, 2023
9d2647c
Fixed a bug that results in unsolved type variables in a call return …
msfterictraut Jul 31, 2023
567bbc2
Fixed a bug that resulted in incorrect type evaluation when a generic…
msfterictraut Jul 31, 2023
050a3c6
Fixed a bug in the command-line version of pyright where it did not e…
msfterictraut Aug 1, 2023
fb56dcc
Fixed a bug that led to a false negative when determining whether two…
erictraut Aug 1, 2023
66281f5
Fixed a bug that resulted in a false positive error when using an unp…
msfterictraut Aug 1, 2023
76ea0f8
Fixed a bug that resulted in a false positive error when a captured v…
erictraut Aug 1, 2023
f064f0f
Fixed bug that led to incorrect type evaluation when accessing the `n…
msfterictraut Aug 1, 2023
e0c05cf
Published 1.1.320
msfterictraut Aug 2, 2023
d2c67d1
Filter import suggestions when py.typed is available (#5627)
rchiodo Aug 2, 2023
fcee52c
pull-pylance-with-pyright-1.1.320 (#5634)
PylanceBot Aug 2, 2023
1a415e4
Fixed a bug that led to a false positive in certain cases where a Par…
msfterictraut Aug 2, 2023
70f6088
Fixed a bug that resulted in a type evaluation error when using bidir…
erictraut Aug 3, 2023
5392340
Fixed a bug that resulted in an off-by-one error in an error message …
msfterictraut Aug 4, 2023
52dc6a5
Fixed a bug that resulted in a false positive `reportIncompatibleMeth…
msfterictraut Aug 4, 2023
62f0b20
Revert "Fixed a bug that led to a false negative when determining whe…
msfterictraut Aug 4, 2023
14f60c7
Fixed a bug that resulted in an incorrect hover type (and inlay hint)…
erictraut Aug 4, 2023
44706ad
Added more complete logging for assertion failure that shows up in te…
msfterictraut Aug 4, 2023
7444078
Addressed a performance regression introduced in 1.1.314 due to a swi…
msfterictraut Aug 6, 2023
cbe583a
Implemented small performance enhancement that reduces memory allocat…
msfterictraut Aug 6, 2023
1825809
Added check for improper use of a type alias defined using the `type`…
erictraut Aug 7, 2023
f5af5bb
Fixed bug that led to a false positive error in certain cases when us…
erictraut Aug 8, 2023
889e8c9
Added internal propagation of constructorTypeVarScopeId for ParamSpec…
msfterictraut Aug 8, 2023
eb9702d
Fixed a bug that led to incorrect type narrowing on assignment in cer…
erictraut Aug 8, 2023
4b088a8
Published 1.1.321
msfterictraut Aug 9, 2023
444f331
Fixed recent regression that led to a false positive when assigning a…
erictraut Aug 9, 2023
634c807
pull-pylance-with-pyright-1.1.321 (#5676)
PylanceBot Aug 9, 2023
fb78629
Fixed a bug that led to a spurious "Unknown" type when an assignment …
msfterictraut Aug 10, 2023
ef30049
Fixed false positive error when an empty tuple was used in an `except…
msfterictraut Aug 11, 2023
7d68470
Published 1.1.322
msfterictraut Aug 11, 2023
bf47498
Fixed a condition in the code flow engine that corrupted internal sta…
erictraut Aug 11, 2023
91f5d40
Fixed bug that resulted in incorrect type evaluation for an async fun…
msfterictraut Aug 12, 2023
8166344
Support zip imports from `.jar` files (#5644)
debonte Aug 12, 2023
792dc97
Fixed bug that led to false negative when assignment expression (walr…
msfterictraut Aug 12, 2023
a0225ed
Fixed a bug that resulted in incorrect type evaluation (and a false p…
erictraut Aug 13, 2023
eefc0f4
Improved error reporting for a couple of diagnostic checks by using t…
msfterictraut Aug 13, 2023
393be11
Merge branch 'main' of https://github.com/microsoft/pyright into main
msfterictraut Aug 13, 2023
2260cce
Updated typeshed to the latest. This update includes some changes to …
msfterictraut Aug 15, 2023
5f5ade4
Revert "Reverted the change for #5446 because it's causing false posi…
erictraut Aug 15, 2023
85483be
Fixed a bug that resulted in a false positive `reportUnnecessaryCompa…
msfterictraut Aug 15, 2023
e1cade2
Added special-case handling of enum fields that are callables, which …
msfterictraut Aug 15, 2023
9d21b77
Added check to enforce a generator's "send type" in a `yield from` st…
erictraut Aug 15, 2023
968187f
Added special-case logic for fields with the name `__hash__` within a…
erictraut Aug 15, 2023
a324a05
Fixed import ordering. No functional change.
msfterictraut Aug 15, 2023
a8bc692
Added support for `...` in the last type argument of `Concatenate`. A…
msfterictraut Aug 15, 2023
99825fb
Tweaked some error messages to improve consistency.
msfterictraut Aug 15, 2023
215fc47
Fixed a bug that led to a false negative when assigning a dictionary …
msfterictraut Aug 15, 2023
7fcf314
Fixed a bug that led to a false negative when a TypeVar was used inap…
erictraut Aug 15, 2023
15588f9
Fixed bug in protocol matching that led to an incorrect protocol matc…
msfterictraut Aug 15, 2023
c552947
Added type compatibility enforcement for symbols imported via a wildc…
erictraut Aug 15, 2023
682961d
Added support for indexing into tuples of indeterminate length as lon…
erictraut Aug 15, 2023
97e432a
Fixed type narrowing bug that affected the `A is B` type narrowing pa…
msfterictraut Aug 15, 2023
88c3b75
Fixed false positive where an inner function within a method uses a T…
msfterictraut Aug 15, 2023
50a930a
Fixed a bug that led to a false positive when accessing a `cached_pro…
msfterictraut Aug 15, 2023
32ef0a2
Fixed a bug in import resolver that caused a site-packages module to …
msfterictraut Aug 16, 2023
e728500
Fixed bug that led to a false positive when a two-argument form of a …
msfterictraut Aug 16, 2023
8b83caa
Published 1.1.323
msfterictraut Aug 16, 2023
03f79a8
pull-pylance-with-pyright-1.1.323 (#5736)
PylanceBot Aug 16, 2023
be94058
Fixed a bug that led to a false positive error under certain circumst…
msfterictraut Aug 16, 2023
d1c170d
Fixed bug that can result in a false positive error when a wildcard i…
msfterictraut Aug 16, 2023
6e5f356
Fixed a false positive error when invoking a call of a variable that …
msfterictraut Aug 16, 2023
745f064
Fixed a bug that caused an incorrect application of a ParamSpec in ce…
msfterictraut Aug 16, 2023
33afc30
Improved validation of `NamedTuple` and `namedtuple` factory calls. T…
erictraut Aug 16, 2023
a5a6a19
Fix partial rename in tests (#5740)
TheTripleV Aug 17, 2023
b8d2785
Improved detection of redundant pattern capture targets in `case` sta…
msfterictraut Aug 17, 2023
c9bf652
Changed the type evaluation logic for the enum `value` member so a cu…
msfterictraut Aug 17, 2023
adebfbd
Fixed a bug that led to a false positive in the `reportIncompatibleMe…
erictraut Aug 17, 2023
8f1eda2
Fixed bug that resulted in a false positive error when an `async` fun…
msfterictraut Aug 17, 2023
9a059b5
Fixed a bug that led to a false positive in the `reportIncompatibleMe…
msfterictraut Aug 17, 2023
349888f
WIP
varungandhi-src Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
33 changes: 9 additions & 24 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,39 +23,24 @@
"no-inner-declarations": 0,
"no-unused-vars": "off",
"no-undef": 0,
"simple-import-sort/imports": [
"error",
{
"groups": [
// Defaults from simple-import-sort, but with local packages between third-party and relative imports.
[
"^\\u0000"
],
[
"^@?\\w"
],
[
"^[^.]"
],
[
"^pyright"
],
[
"^\\."
]
]
}
],
"simple-import-sort/exports": "error",
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/ban-types": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/member-ordering": [
"error",
{
"classes": ["field", "constructor", ["public-get", "public-set"], "public-method", ["protected-get", "protected-set"], "protected-method", ["private-get", "private-set"], "private-method"],
"interfaces": []
}
],
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-namespace": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/explicit-member-accessibility": ["error", { "accessibility": "no-public" }],
"@typescript-eslint/no-unused-vars": [
"error",
{
Expand Down Expand Up @@ -92,7 +77,7 @@
"accessor"
],
"modifiers": ["protected"],
"leadingUnderscore": "allow",
"leadingUnderscore": "forbid",
"format": ["camelCase"],
"filter": {
"regex": "^(test_| )",
Expand Down
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Report incorrect or unintended behaviors
title: ''
labels: bug
assignees: ''

---

Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues.

If you have a question about typing or a behavior that you’re seeing in Pyright (as opposed to a bug report or enhancement request), consider posting to the [Pyright discussion forum](https://github.com/microsoft/pyright/discussions).

**Describe the bug**
A clear and concise description of the behavior you are seeing and the expected behavior along with steps to reproduce it.

**Code or Screenshots**
If possible, provide a minimal, self-contained code sample (surrounded by triple back ticks) to demonstrate the issue. The code should define or import all referenced symbols.

```python
def foo(self) -> str:
return 3
```

If your code relies on symbols that are imported from a third-party library, include the associated import statements and specify which versions of those libraries you have installed.

**VS Code extension or command-line**
Are you running pyright as a VS Code extension, a language server in another editor, integrated into Pylance, or the command-line tool? Which version?
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea or improvement
title: ''
labels: enhancement request
assignees: ''

---

If you have a question about a behavior that you’re seeing in pyright, consider posting to the [Pyright discussion forum](https://github.com/microsoft/pyright/discussions).

**Is your feature request related to a problem? Please describe.**
A clear and concise description of the problem.

**Describe the solution you’d like**
A clear and concise description of the solution you would like to see.

101 changes: 101 additions & 0 deletions .github/workflows/mypy_primer_comment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This workflow runs when the "Run mypy_primer on PR" workflow completes.
# It downloads the diff from the other workflow instances and creates
# a summary comment in the PR.
name: Comment with mypy_primer diff

on:
workflow_run:
workflows:
- Run mypy_primer on PR
types:
- completed

permissions:
contents: read
pull-requests: write

jobs:
comment:
name: Comment PR from mypy_primer
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download diffs
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
const [matchArtifact] = artifacts.data.artifacts.filter((artifact) =>
artifact.name == "mypy_primer_diffs");

const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: "zip",
});
fs.writeFileSync("diff.zip", Buffer.from(download.data));

- run: unzip diff.zip
- run: |
cat diff_*.txt | tee fulldiff.txt

- name: Post comment
id: post-comment
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const MAX_CHARACTERS = 30000
const MAX_CHARACTERS_PER_PROJECT = MAX_CHARACTERS / 3

const fs = require('fs')
let data = fs.readFileSync('fulldiff.txt', { encoding: 'utf8' })

function truncateIfNeeded(original, maxLength) {
if (original.length <= maxLength) {
return original
}
let truncated = original.substring(0, maxLength)
// further, remove last line that might be truncated
truncated = truncated.substring(0, truncated.lastIndexOf('\n'))
let lines_truncated = original.split('\n').length - truncated.split('\n').length
return `${truncated}\n\n... (truncated ${lines_truncated} lines) ...`
}

const projects = data.split('\n\n')
// don't let one project dominate
data = projects.map(project => truncateIfNeeded(project, MAX_CHARACTERS_PER_PROJECT)).join('\n\n')
// posting comment fails if too long, so truncate
data = truncateIfNeeded(data, MAX_CHARACTERS)

console.log("Diff from mypy_primer:")
console.log(data)

let body
if (data.trim()) {
body = 'Diff from [mypy_primer](https://github.com/hauntsaninja/mypy_primer), showing the effect of this PR on open source code:\n```diff\n' + data + '```'
} else {
body = "According to [mypy_primer](https://github.com/hauntsaninja/mypy_primer), this change doesn't affect type check results on a corpus of open source code. ✅"
}
const prNumber = parseInt(fs.readFileSync("pr_number.txt", { encoding: "utf8" }))
await github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body
})
return prNumber

- name: Hide old comments
# v0.4.0
uses: kanga333/comment-hider@c12bb20b48aeb8fc098e35967de8d4f8018fffdf
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
leave_visible: 1
issue_number: ${{ steps.post-comment.outputs.result }}
91 changes: 91 additions & 0 deletions .github/workflows/mypy_primer_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# This workflow runs mypy_primer, a tool that runs pyright on a variety
# of open-source Python projects that are known to type check with pyright.
# It builds pyright from the latest PR commit and the merge base of the PR
# and compares the output of both. It uploads the diffs as an artifact and
# creates a PR comment with the results (with the help of the
# mypy_primer_comment action).

# This workflow definition borrows liberally from the mypy repo. The original
# workflow was designed to work in a sharded manner where n copies of
# mypy_primer are started in parallel. Each instance runs 1/n of the projects.
# For now, we run only one instance because pyright is fast, and the number
# of projects that use pyright for type checking is small. To change this in
# the future, change the 'shard_index' matrix to [0, 1, ..., n-1] and set
# 'num-shards' to n.

name: Run mypy_primer on PR

on:
# Run on the creation or update of a PR.
pull_request:
paths:
- 'packages/pyright/**'
- 'packages/pyright-internal/src/**'
- 'packages/pyright-internal/typeshed-fallback/**'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
mypy_primer:
name: Run mypy_primer on PR
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
shard-index: [0, 1]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
path: pyright_to_test
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -U pip
pip install git+https://github.com/hauntsaninja/mypy_primer.git
- name: Run mypy_primer
shell: bash
run: |
cd pyright_to_test
echo "new commit"
git rev-list --format=%s --max-count=1 $GITHUB_SHA

MERGE_BASE=$(git merge-base $GITHUB_SHA origin/$GITHUB_BASE_REF)
git checkout -b base_commit $MERGE_BASE
echo "base commit"
git rev-list --format=%s --max-count=1 base_commit

echo ''
cd ..
# fail action if exit code isn't zero or one
(
mypy_primer \
--repo pyright_to_test \
--type-checker pyright \
--new $GITHUB_SHA --old base_commit \
--num-shards 2 --shard-index ${{ matrix.shard-index }} \
--debug \
--output concise \
| tee diff_${{ matrix.shard-index }}.txt
) || [ $? -eq 1 ]
- name: Upload mypy_primer diff
uses: actions/upload-artifact@v3
with:
name: mypy_primer_diffs
path: diff_${{ matrix.shard-index }}.txt
- if: ${{ matrix.shard-index }} == 0
name: Save PR number
run: |
echo ${{ github.event.pull_request.number }} | tee pr_number.txt
- if: ${{ matrix.shard-index }} == 0
name: Upload PR number
uses: actions/upload-artifact@v3
with:
name: mypy_primer_diffs
path: pr_number.txt
65 changes: 65 additions & 0 deletions .github/workflows/mypy_primer_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow runs mypy_primer, a tool that runs pyright on a variety
# of open-source Python projects that are known to type check with pyright.
# It builds pyright from the latest commit and the last release tag and
# compares the output of both. It uploads the diffs as an artifact.
name: Run mypy_primer on push

on:
# Run on all pushes to main.
push:
branches:
- main
paths:
- 'packages/pyright/**'
- 'packages/pyright-internal/src/**'
- 'packages/pyright-internal/typeshed-fallback/**'
# Also run manually if requested.
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
mypy_primer:
name: Run mypy_primer on push
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
path: pyright_to_test
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install -U pip
pip install git+https://github.com/hauntsaninja/mypy_primer.git
- name: Run mypy_primer
shell: bash
run: |
cd pyright_to_test
echo "new commit"
git rev-list --format=%s --max-count=1 $GITHUB_SHA

cd ..
# fail action if exit code isn't zero or one
(
mypy_primer \
--repo pyright_to_test \
--type-checker pyright \
--new $GITHUB_SHA \
--debug \
--output concise \
| tee diff.txt
) || [ $? -eq 1 ]
- name: Upload mypy_primer diff
uses: actions/upload-artifact@v3
with:
name: mypy_primer_diffs
path: diff.txt
6 changes: 3 additions & 3 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-

- run: npm install
- run: npm run install:all

- run: npx lerna exec --stream --no-bail -- tsc --noEmit

Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-

- run: npm install
- run: npm run install:all

- name: npm test (pyright-internal)
run: npm test
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-

- run: npm install
- run: npm run install:all

- run: npm publish --dry-run
working-directory: packages/pyright
Expand Down
Loading