Commit Graph

5325 Commits

Author SHA1 Message Date
Eric Traut
49c18e619c Published 1.1.271 2022-09-13 19:33:58 -07:00
Eric Traut
2fd2d80483 Fixed a bug that resulted in a transient false positive error in certain cases where a member access expression was used within a quoted type annotation. This addresses https://github.com/microsoft/pyright/issues/3944. 2022-09-13 19:31:54 -07:00
Eric Traut
fdd45c8d13 Fixed bug that resulted in incorrect type evaluation when an isinstance type guard results in an intersection type and one of the sources of the intersection is a conditional type. Addresses https://github.com/microsoft/pyright/issues/3935. 2022-09-13 19:14:54 -07:00
Eric Traut
a988708851 Fixed a bug that resulted in incorrect type evaluation when narrowing types for class patterns in a match statement when the matched class is a generic subclass of the subject type. Addresses https://github.com/microsoft/pyright/issues/3940. 2022-09-13 19:02:58 -07:00
Eric Traut
aa68a319f2 Added support for quoted TypeAlias type annotation. Addresses https://github.com/microsoft/pyright/issues/3934. 2022-09-13 17:34:01 -07:00
Eric Traut
0976505663 Fixed bug that results in incorrect narrowing for sequence patterns in a match statement in the negative (fall-through) case when the subject type is a tuple of known length but with elements of type Any. Addresses https://github.com/microsoft/pyright/issues/3938. 2022-09-13 08:50:31 -07:00
Eric Traut
f4ebd41b1b Fixed recent regression that resulted in a false positive error when defining a variable in a class body and using its own field name as a type annotation. Addresses #3924. 2022-09-10 22:00:22 -07:00
Eric Traut
ce5caa2829 Added new check for an attempt to instantiate Dict, Set, List, or Tuple from typing module. This generates a runtime exception. Implements #3921. 2022-09-10 15:50:20 -07:00
PylanceBot
95c059fad7
pull-pylance-with-pyright-1.1.270 (#3920)
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>
2022-09-07 11:59:07 -07:00
Eric Traut
2d195c1c22 Fixed a bug that resulted in infinite recursion when a global statement is used within the global scope of a module. 2022-09-07 07:31:41 -07:00
Eric Traut
a0714e2534 Fixed an infinite recursion bug in the type printer that shows up occasionally in the crash telemetry. 2022-09-07 07:30:43 -07:00
Eric Traut
d746e6b621 Fixed a bug in assertNever internal function that resulted in a crash when attempting to stringify a recursive data structure. This shows up occasionally in the crash telemetry. 2022-09-07 07:30:03 -07:00
Eric Traut
d09fdedba6 Published 1.1.270 2022-09-06 18:04:56 -07:00
Eric Traut
0c3ae9ff55 Revert "Fixed a bug that incorrectly synthesized an __init__ method for a class that derives from a class decorated with dataclass_transform when a class within the hierarchy provides a custom __init__ method."
This reverts commit f74557c6e4.
2022-09-05 19:26:45 -07:00
Eric Traut
05da4588e0 Updated PEP 695 functionality to reflect the latest changes in the spec. 2022-09-04 14:08:08 -06:00
Eric Traut
ae857594d3 Fixed a bug in the type checker that led it to conclude that two types were the same even though they were declared in separate modules. This occurred when the types had the same (local) name and both modules were located within project directories that contained characters that are invalid for module paths in an import statement (e.g. "-"). 2022-09-04 08:41:59 -06:00
Eric Traut
442ffb4a9d Updated typeshed stubs to the latest version. 2022-09-03 19:49:57 -06:00
Eric Traut
f74557c6e4 Fixed a bug that incorrectly synthesized an __init__ method for a class that derives from a class decorated with dataclass_transform when a class within the hierarchy provides a custom __init__ method. 2022-09-03 19:33:39 -06:00
Eric Traut
9bb6a1ab97 Fixed a bug that resulted in a false negative when an annotated variable was assigned an expression that included the variable's name and the variable was undefined prior to the assignment. 2022-09-03 14:55:53 -06:00
Eric Traut
4105b97749 Updated documentation for pre-commit hooks to eliminate confusion and point users to the pyright-python wrapper. 2022-09-03 11:58:28 -06:00
Eric Traut
7b69778781 Fixed bug in type evaluator that caused a false negative in some circumstances when constructing an instance of a generic class within that class implementation. 2022-09-03 08:29:33 -06:00
timsu92
eb94467687
docs: fix wrong description of reportUndefinedVariable (#3903) 2022-09-03 06:36:38 -06:00
Eric Traut
e077a8a1d0 Fixed style issue. 2022-09-02 19:29:15 -06:00
Eric Traut
dc63fdf682 Fixed type evaluation bug that led to a false positive error when assigning a type conditioned on a bound TypeVar to that same TypeVar in an invariant context. 2022-09-02 19:16:31 -06:00
Eric Traut
32e4e14e21 Enhanced the reportUnusedExpression check to detect unused dictionary, list and set expressions if they don't contain comprehensions. 2022-09-02 00:04:46 -06:00
Eric Traut
f92f6abf79 Fixed a bug that resulted in a false positive when passing a generic function to an overloaded function that requires union expansion to resolve. 2022-09-01 23:26:38 -06:00
Eric Traut
b63ee3a730 Expanded reportUnusedExpression check to detect unused tuple expressions. 2022-09-01 22:55:12 -06:00
Eric Traut
660e994521 Fixed a bug that resulted in unpacked arguments to a class definition going unevaluated, which means that any symbols they referenced were not marked accessed. 2022-09-01 17:44:09 -06:00
Eric Traut
295c96266a Added support for TypeVarTuple to capture an unpacked tuple with unbounded length. 2022-09-01 00:15:09 -06:00
Eric Traut
0a6ef3ffb4 Fixed a bug that led to the incorrect inferred return type for a super().__new__(cls) call. 2022-08-31 15:42:25 -06:00
Eric Traut
b24d4623dc Fixed a bug that resulted in incorrect type narrowing for literal patterns in a match statement when the target expression type includes an instance of a class that derives from the literal's class (e.g. a subclass of str). 2022-08-31 12:58:41 -06:00
PylanceBot
aba41864a6
[PylanceBot] Pull Pylance with Pyright 1.1.269 (#3887) 2022-08-31 11:44:22 -07:00
Eric Traut
89a9ff5610 Improved precision of error reporting for list and set expressions. 2022-08-31 00:10:26 -06:00
Eric Traut
02451ddae7 Improved precision of error handling for tuples. 2022-08-30 23:58:36 -06:00
Eric Traut
36df440e52 Published 1.1.269 2022-08-30 18:32:27 -06:00
Eric Traut
45d842a87b Fixed bug that resulted in incorrect type evaluation when solving for a contravariant type variable when a union of callables is passed as an argument. 2022-08-30 18:02:38 -06:00
Eric Traut
1beb510627 Mitigated performance regression recently introduced in the import cycle detection logic. 2022-08-30 17:27:20 -06:00
Eric Traut
c462466485 Fixed a bug that resulted in a false positive error when determining type compatibility of a generic type with an invariant type parameter and a type argument that is a union which includes an instance of a class and an instance of a subclass. 2022-08-30 14:27:10 -06:00
Eric Traut
d6d188b397 Enhanced the type(x) is y type guard logic to support the case where x is typed with a TypeVar bound to a class. 2022-08-30 12:16:22 -06:00
Eric Traut
93a4f98ccd Fixed a bug that led to a false negative when assigning a concrete type to an instance variable with a generic (class-scoped) type. 2022-08-30 00:09:56 -06:00
Eric Traut
e5f489be20 Fixed bug that resulted in a false positive error when specifying a metaclass that contains an __init__ method with unannotated parameters. 2022-08-28 23:15:14 -06:00
Eric Traut
1ec5cd1304 Fixed a bug that resulted in the reportImportCycles check to sometimes fail to detect and report some import cycles. 2022-08-27 22:42:02 -06:00
Eric Traut
f107f0f323 Published 1.1.268 2022-08-23 21:26:39 -07:00
Eric Traut
72f1f7f20f Updated typeshed stubs to the latest version 2022-08-23 21:18:02 -07:00
Eric Traut
3e04632f4b Added a missing check for a **kwargs parameter immediately after a keyword-only separator * parameter. This generates a compiler error in Python. 2022-08-22 19:58:25 -07:00
Eric Traut
41c47a08ea Increased the code complexity limit that controls whether pyright performs return type inference for functions that have no parameter type annotations. This can be quite expensive, and without parameter types, the results are often low quality. Beyond a certain point, we just skip the expensive analysis and infer a return type of Unknown. The previous limit was quite low. This increases the limit in an attempt to handle return type inference in more of these cases. 2022-08-22 19:22:27 -07:00
Eric Traut
b74be3b2cb Extended type narrowing support for x in y pattern where y is a tuple of known length that includes literal types. In this case, negative ("else") type narrowing can be applied if x is a union that includes literals. 2022-08-19 18:50:07 -07:00
Eric Traut
e4b41e1a30 Improved error reporting for dict literal expressions that are assigned to TypedDict types. Previously, the entire dict literal was included in the error range. Now the range is limited to a specific dictionary entry if there is only one error. 2022-08-19 18:16:50 -07:00
Eric Traut
346999a2e6 Fixed a bug that resulted in a false positive when analyzing a call to an instance method that omits a self parameter and instead uses *args. 2022-08-19 16:29:59 -07:00
Eric Traut
341af785aa Fixed a bug that resulted in a false negative when using an unparenthesized assignment expression in an assert statement. Also improved the error messages and parser recovery for incorrect use of a unparenthesized assignment expressions. 2022-08-19 11:38:03 -07:00